ImageBuilder.h
Go to the documentation of this file.
00001 /******************************************************************************
00002  * Copyright (c) 2012, 2013 All Rights Reserved, http://www.optris.de         *                                                                          *
00003  *  Optris GmbH                                                               *
00004  *  Ferdinand-Buisson-Str. 14                                                 *
00005  *  13127 Berlin                                                              *
00006  *  Germany                                                                   *
00007  *                                                                            *
00008  * Contributors:                                                              *
00009  * - Linux platform development in cooperation with Nuremberg Institute of    *
00010  *   Technology Georg Simon Ohm, http//www.th-nuernberg.de                    *
00011  * - Linux 64-Bit platform supported by Fraunhofer IPA,                       *
00012  *   http://www.ipa.fraunhofer.de                                             *
00013  *****************************************************************************/
00014 
00015 #ifndef OPTRISIMAGEBUILDER_H
00016 #define OPTRISIMAGEBUILDER_H
00017 
00018 namespace optris
00019 {
00020 
00021 struct ExtremalRegion
00022 {
00023   float t;
00024   int u1;
00025   int v1;
00026   int u2;
00027   int v2;
00028 };
00029 
00030 enum EnumOptrisColoringPalette{eAlarmBlue   = 1,
00031                                                            eAlarmBlueHi = 2,
00032                                                            eGrayBW      = 3,
00033                                                            eGrayWB      = 4,
00034                                                            eAlarmGreen  = 5,
00035                                                            eIron        = 6,
00036                                                            eIronHi      = 7,
00037                                                            eMedical     = 8,
00038                                                            eRainbow     = 9,
00039                                                            eRainbowHi   = 10,
00040                                                            eAlarmRed    = 11};
00041 
00042 enum EnumOptrisPaletteScalingMethod{eManual = 1,
00043                                                                         eMinMax = 2,
00044                                                                         eSigma1 = 3,
00045                                                                         eSigma3 = 4};
00046 
00047 typedef unsigned char (*paletteTable)[3];
00048 
00053 class ImageBuilder
00054 {
00055 public:
00059         ImageBuilder(bool alignStride=true);
00060 
00064   ~ImageBuilder();
00065 
00072   void setData(unsigned int width, unsigned int height, unsigned short* data);
00073 
00078   unsigned int getWidth();
00079 
00084   unsigned int getHeight();
00085 
00091   float getTemperatureAt(int index);
00092 
00099   float getTemperatureAt(int u, int v);
00100 
00109   float getMeanTemperature(int u1, int v1, int u2, int v2);
00110 
00117   void getMinMaxRegion(int radius, ExtremalRegion* minRegion, ExtremalRegion* maxRegion);
00118 
00124   void setManualTemperatureRange(float min, float max);
00125 
00130   float getIsothermalMin();
00131 
00136   float getIsothermalMax();
00137 
00142   void setPaletteScalingMethod(EnumOptrisPaletteScalingMethod method);
00143 
00148   EnumOptrisPaletteScalingMethod getPaletteScalingMethod();
00149 
00154   unsigned int getStride(void);
00155 
00160   void setPalette(EnumOptrisColoringPalette palette);
00161 
00166   EnumOptrisColoringPalette getPalette();
00167 
00172   void getPaletteTable(paletteTable& table);
00173 
00178   void fillPaletteLookup(unsigned int lut[65536]);
00179 
00185   void convertTemperatureToPaletteImage(unsigned char* dst, bool ignoreStride=false);
00186 
00192   void convertTemperatureToPaletteImage(unsigned int lut[65536], unsigned char* dst);
00193 
00201   void calcHistogram(unsigned int* hist, unsigned int histsize, int tMin, int tMax);
00202 
00209   void drawCrosshair(unsigned char* img, unsigned int x, unsigned int y, unsigned channels=3);
00210 
00218   void yuv422torgb24(const unsigned char* src, unsigned char* dst, unsigned int w, unsigned int h);
00219 
00220 private:
00221 
00222   void calculateIntegralImage();
00223 
00227   void calcMinMaxScalingFactor();
00228 
00233   void calcSigmaScalingFactor(float sigma);
00234 
00238   unsigned short* _data;
00239 
00243   unsigned long* _integral;
00244 
00248   EnumOptrisPaletteScalingMethod _scalingMethod;
00249 
00253   unsigned short _min;
00254 
00258   unsigned short _max;
00259 
00263   unsigned int _width;
00264 
00268   unsigned int _height;
00269 
00273   unsigned int  _stride;
00274 
00278   unsigned int _size;
00279 
00283   EnumOptrisColoringPalette _palette;
00284 
00288   bool _alignStride;
00289 
00293   bool _integralIsDirty;
00294 };
00295 
00296 }
00297 
00298 #endif //OPTRISIMAGEBUILDER_H


optris_drivers
Author(s): Stefan May (Nuremberg Institute of Technology Georg Simon Ohm - www.th-nuernberg.de), 64-Bit platform supported by Fraunhofer IPA (www.ipa.fraunhofer.de), Support for ROS hydro migration by Christopher-Eyk Hrabia (DAI-Labor, Technische Universität Berlin)
autogenerated on Mon Oct 6 2014 03:09:39