FloatImage.h
Go to the documentation of this file.
00001 #ifndef FLOATIMAGE_H
00002 #define FLOATIMAGE_H
00003 
00004 #include <algorithm>
00005 #include <vector>
00006 
00007 namespace DualCoding {
00008         typedef unsigned char uchar;
00009         template<typename T> class Sketch;
00010 }
00011 
00012 namespace AprilTags {
00013 
00015 class FloatImage {
00016 private:
00017   int width;
00018   int height;
00019   std::vector<float> pixels;
00020 
00021 public:
00022 
00024   FloatImage();
00025 
00027   FloatImage(int widthArg, int heightArg);
00028 
00030   FloatImage(int widthArg, int heightArg, const std::vector<float>& pArg);
00031 
00032   FloatImage& operator=(const FloatImage& other);
00033 
00034   float get(int x, int y) const { return pixels[y*width + x]; }
00035   void set(int x, int y, float v) { pixels[y*width + x] = v; }
00036   
00037   int getWidth() const { return width; }
00038   int getHeight() const { return height; }
00039   int getNumFloatImagePixels() const { return width*height; }
00040   const std::vector<float>& getFloatImagePixels() const { return pixels; }
00041 
00043   void decimateAvg();
00044 
00046   void normalize();
00047 
00048   void filterFactoredCentered(const std::vector<float>& fhoriz, const std::vector<float>& fvert);
00049 
00050   template<typename T>
00051   void copyToSketch(DualCoding::Sketch<T>& sketch) {
00052     for (int i = 0; i < getNumFloatImagePixels(); i++)
00053       sketch[i] = (T)(255.0f * getFloatImagePixels()[i]);
00054   }
00055 
00056   void printMinMax() const;
00057 };
00058 
00059 } // namespace
00060 
00061 #endif


apriltags
Author(s): Mitchell Wills
autogenerated on Thu Aug 27 2015 12:23:28