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

Revision 86, 2.0 KB checked in by dave, 12 years ago (diff)

lots of code added - pca implementation for eigenfaces and lda started

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