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

Revision 94, 2.1 KB checked in by dave, 10 years ago (diff)

added face classifier application, not working yet

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 "Vector.h"
19#include <string>
20
21#ifndef IMAGE
22#define IMAGE
23
24class Image
25{
26public:
27        Image() : m_Image(NULL) {}
28        Image(int w, int h, int d, int c);
29        Image(const std::string &filename);
30        Image(const Image &other);
31        Image(const IplImage *other); // copies the given image
32        Image(int w, int h, int c, const Vector<float> &v, float gain=1.0f);
33        ~Image();
34
35        void Clear();
36
37        Image operator-(const Image &other);
38        Image operator+(const Image &other);
39        Image &operator=(const Image &other);
40
41        void PrintInfo();
42       
43        void Crop(int x, int y, int w, int h);
44        Image Scale(int w, int h);
45        Image SubImage(int x, int y, int w, int h);
46
47        // Paste an image into this one
48        void Blit(const Image &image, int x, int y);
49       
50        // Return a sum of squared differences, for giving a similarity metric
51        float SSD(Image &other);
52       
53        // Subtract the mean - this is useful for accounting for global lighting changes
54        void SubMean();
55       
56        // Convert the image into a local binary patterns image
57        void LBP();
58       
59        // Convert to different colour spaces
60        Image GRAY2RGB();
61        Image RGB2GRAY();
62        Image BayerGB2RGB();
63       
64        // Calculate a histogram for a given channel
65        unsigned int *Hist(int channel);
66       
67        Vector<float> ToFloatVector();
68        unsigned int NumElements() { return m_Image->width*m_Image->height*m_Image->nChannels; }
69       
70        IplImage *m_Image;
71       
72private:
73        unsigned char SafeGet2D(int y, int x, int c);
74};
75
76#endif
Note: See TracBrowser for help on using the repository browser.