source: foam/trunk/vision/src/Image.h @ 85

Revision 85, 1.8 KB checked in by dave, 12 years ago (diff)

started writing the LDA classifier

Line 
1// Copyright (C) 2009 foam
2//
3// This program is free software; you can redistribute it and/or modify
4// it under the terms of the GNU General Public License as published by
5// the Free Software Foundation; either version 2 of the License, or
6// (at your option) any later version.
7//
8// This program is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11// GNU General Public License for more details.
12//
13// You should have received a copy of the GNU General Public License
14// along with this program; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17#include "cv.h"
18#include <string>
19
20#ifndef IMAGE
21#define IMAGE
22
23class Image
24{
25public:
26        Image(int w, int h, int d, int c);
27        Image(const std::string &filename);
28        Image(const Image &other);
29        Image(const IplImage *other); // copies the given image
30        ~Image();
31
32        void Clear();
33
34        Image operator-(const Image &other);
35        Image operator+(const Image &other);
36
37        void PrintInfo();
38       
39        void Crop(int x, int y, int w, int h);
40        void Scale(int w, int h);
41
42        // Paste an image into this one
43        void Blit(const Image &image, int x, int y);
44       
45        // Return a sum of squared differences, for giving a similarity metric
46        float SSD(Image &other);
47       
48        // Subtract the mean - this is useful for accounting for global lighting changes
49        void SubMean();
50       
51        // Convert the image into a local binary patterns image
52        void LBP();
53       
54        // Convert to different colour spaces
55        void GRAY2RGB();
56        void RGB2GRAY();
57        void BayerGB2RGB();
58       
59        // Calculate a histogram for a given channel
60        unsigned int *Hist(int channel);
61       
62        IplImage *m_Image;
63       
64private:
65        unsigned char SafeGet2D(int y, int x, int c);
66};
67
68#endif
Note: See TracBrowser for help on using the repository browser.