• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

include/FCam/SharpnessMap.h

Go to the documentation of this file.
00001 #ifndef FCAM_SHARPNESS_MAP_H
00002 #define FCAM_SHARPNESS_MAP_H
00003 
00004 #include <vector>
00005 
00010 namespace FCam {
00014     class SharpnessMapConfig {
00015       public:
00018         SharpnessMapConfig() : size(0, 0), enabled(false) {}
00019 
00023         Size size;
00024 
00026         bool enabled;
00027 
00030         bool operator==(const SharpnessMapConfig &other) const {
00031             if (enabled != other.enabled) return false;
00032             if (enabled && size != other.size) return false;
00033             return true;
00034         }
00035 
00038         bool operator!=(const SharpnessMapConfig &other) const {
00039             return !((*this) == other);
00040         }
00041     };    
00042 
00043 
00047     class SharpnessMap {
00048     private:
00049         Size _size;
00050         unsigned _channels;
00051         std::vector<unsigned> _data;
00052 
00053     public:
00054 
00056         SharpnessMap() : _size(0, 0), _channels(0) {
00057         }
00058 
00060         SharpnessMap(Size s, int channels) : _size(s), _channels(channels) {
00061             _data.resize(s.width*s.height*channels);            
00062         }
00063 
00073         unsigned operator()(int x, int y, int c) const {
00074             return _data[(y*_size.width+x)*_channels + c];
00075         }
00076 
00079         unsigned &operator()(int x, int y, int c) {
00080             return _data[(y*_size.width+x)*_channels + c];
00081         }
00082 
00085         unsigned operator()(int x, int y) const {
00086             unsigned total = 0;
00087             for (size_t c = 0; c < _channels; c++) {
00088                 total += (*this)(x, y, c);
00089             }
00090             return total;
00091         }       
00092 
00094         bool valid() const {return _data.size() != 0;}
00095 
00097         unsigned channels() const {return _channels;}
00098 
00100         const Size &size() const {return _size;} 
00101 
00103         int height() const {return _size.height;}
00104 
00106         int width() const {return _size.width;}
00107 
00110         unsigned *data() {return &_data[0];}
00111     };
00112 }
00113 
00114 #endif

Generated on Fri Sep 24 2010 15:53:00 for FCam by  doxygen 1.7.1