roiEmptySpaceFinder.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef EQ_ROI_EMPTY_SPACE_FINDER_H
00018 #define EQ_ROI_EMPTY_SPACE_FINDER_H
00019
00020 #include <eq/client/pixelViewport.h>
00021 #include <vector>
00022
00023 namespace eq
00024 {
00028 class ROIEmptySpaceFinder
00029 {
00030 public:
00031 ROIEmptySpaceFinder() : _mask( 0 ) {};
00032 virtual ~ROIEmptySpaceFinder(){};
00033
00036 void update( const uint8_t* mask, const int32_t w, const int32_t h );
00037
00040 PixelViewport getLargestEmptyArea( const PixelViewport& pvp ) const;
00041
00042 inline uint16_t getArea( const int32_t x, const int32_t y,
00043 const int32_t w, const int32_t h ) const;
00044
00045 inline uint16_t getArea( const int32_t x, const int32_t y,
00046 const int32_t w, const int32_t h,
00047 const uint16_t* data ) const;
00048
00049 void setLimits( const int16_t absolute, const float relative )
00050 {
00051 _limAbs = absolute;
00052 _limRel = relative;
00053 }
00054
00055 protected:
00056
00057 private:
00059 void _resize( const int32_t w, const int32_t h );
00060
00061 bool _updateMaximalEmptyRegion( const int32_t x, const int32_t y,
00062 const int32_t w, const int32_t h,
00063 PixelViewport& pvp,
00064 const uint16_t* data ) const;
00065
00066 int32_t _w;
00067 int32_t _h;
00068
00069 int16_t _limAbs;
00070 float _limRel;
00071
00072 UShortVector _data;
00073 const uint8_t* _mask;
00074 };
00075 }
00076
00077 #endif // EQ_ROI_EMPTY_SPACE_FINDER_H
00078