ImageMask.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002  *  ImageMask.h
00003  *
00004  *  (C) 2007 AG Aktives Sehen <agas@uni-koblenz.de>
00005  *           Universitaet Koblenz-Landau
00006  *
00007  *  Additional information:
00008  *  $Id: $
00009  *******************************************************************************/
00010 
00011 #ifndef ImageMask_H
00012 #define ImageMask_H
00013 
00014 #include "GrayLevelImage8.h"
00015 #include "ColorImageRGB8.h"
00016 #include "ColorImageUV8.h"
00017 
00018 #include "Workers/Math/Box2D.h"
00019 
00026 class ImageMask
00027 {
00028   public:
00029 
00030     enum MaskValues {
00031       MASKED = 0,
00032       VISIBLE = 255
00033     };
00034 
00036     ImageMask( );
00037 
00039     ImageMask( const ImageMask& other );
00040     ImageMask& operator=( const ImageMask& other );
00041 
00043     ImageMask( unsigned width, unsigned height, unsigned char* data=0 );
00044 
00046     ImageMask( unsigned width, unsigned height, unsigned char* data, char maskedMin, char maskedMax );
00047 
00049     ImageMask( puma2::GrayLevelImage8& image, unsigned char minVal, unsigned char maxVal=255 );
00050     ImageMask( puma2::ColorImageUV8& image, unsigned char minValU, unsigned char minValV );
00051 
00053     ImageMask(puma2::GrayLevelImage8& foregroundY, puma2::ColorImageUV8& foregroundUv,
00054               puma2::GrayLevelImage8& backgroundY, puma2::ColorImageUV8& backgroundUv,
00055               int threshold );
00056 
00058     ~ImageMask();
00059 
00060     void apply( puma2::GrayLevelImage8& image, unsigned char fillValue=0 );
00061     void apply( puma2::ColorImageUV8& image, unsigned char fillU=0, unsigned char fillV=0 );
00062     void apply( puma2::ColorImageRGB8& image, unsigned char fillR, unsigned char fillG, unsigned char fillB );
00063 
00065     void grayOut( puma2::ColorImageRGB8& colorImage, puma2::GrayLevelImage8& graimageY );
00066     void grayOut( puma2::ColorImageRGB8& colorImage );
00067 
00069     bool findValue( int x, int y, unsigned char value, float radius );
00070 
00075     void erode( float radius=1.0 );
00076 
00081     void dilate( float radius=1.0 );
00082 
00084     void fill( unsigned char value );
00085 
00087     void expand( const ImageMask& other );
00088 
00090     void findBorders( );
00091 
00093     Point2D getGravCenter( );
00094 
00095     Box2D<int> getBoundingBox();
00096 
00098     ImageMask* subMask( Box2D<int> area );
00099 
00105     unsigned char* getData() { return m_Data; }
00106 
00107     inline unsigned getWidth() { return m_Width; }
00108     inline unsigned getHeight() { return m_Height; }
00109 
00110   private:
00111 
00112     enum maskOperationT{
00113       dilateOperation,
00114       erodeOperation
00115     };
00116 
00117     void maskOperation( maskOperationT operation, float radius );
00118 
00120     void createCircularKernel( float radius, int*& maskOffset, int& halfMaskSize, unsigned& maskLength );
00121 
00122     unsigned char* m_Data;
00123 
00124     unsigned m_Width;
00125     unsigned m_Height;
00126 
00127 };
00128 
00129 #endif


obj_rec_gui
Author(s): AGAS/agas@uni-koblenz.de
autogenerated on Mon Oct 6 2014 02:53:43