DLBitsPerPixelConverter.h

Go to the documentation of this file.
00001 #ifndef _DLBITSPERPIXELCONVERTER_H_
00002 #define _DLBITSPERPIXELCONVERTER_H_
00003 
00004 #include "DLImage.h"
00005 #include "DLColor.h"
00006 
00011 enum DL_BINARIZE_TYPE
00012 {
00013    DL_NIBLACK,
00014    DL_SAUVOLA, 
00015    DL_WOLFJOLION, 
00016    DL_ADANIBLACK
00017 };
00018 
00042 class DLBitsPerPixelConverter
00043 {
00044    public:
00045 
00047         enum DLImageConversions {
00048                 DL_2BINARY = 1,
00049                 DL_2GRAY = 2,
00050                 DL_2COLOR = 3
00051         };
00052 
00054         enum DLBinarizeType
00055         {
00056                 DL_NIBLACK,
00057                 DL_SAUVOLA, 
00058                 DL_WOLFJOLION, 
00059                 DL_ADANIBLACK
00060         };
00061 
00068    static DLImage dlBinary2Gray ( const DLImage& imageData  ) ;
00069 
00078    static DLImage dlGray2Color ( const DLImage& imageData  ) ;
00079 
00087    static DLImage dlBinary2Color ( const DLImage& imageData, const DLColor & color ) ;
00088 
00100    static DLImage dlBinary2Color ( const DLImage& imageData, DL_BYTE r = DL_BLACK, DL_BYTE g = DL_BLACK, DL_BYTE b = DL_BLACK ) ;
00101 
00115    static DLImage dlConvertImage ( const DLImage& imageData, DLImageConversions conversionCode ) ;
00116 
00117 
00126    static DLImage dlDownscaleGray2Binary_global(const DLImage& imageData, int th = static_cast<int>(DL_WHITE/2));
00127 
00177    static DLImage dlDownscaleGray2Binary_niblack(const DLImage& gImg, DL_BINARIZE_TYPE algorithm = (DL_BINARIZE_TYPE)DL_ADANIBLACK, double k = -0.5, bool detect_inverted = true);
00178 
00230    static DLImage dlDownscaleGray2Binary_niblack(const DLImage& gImg, DLBitsPerPixelConverter::DLBinarizeType algorithm, double k = -0.5, bool detect_inverted = true);
00231 
00232 
00239    static DLImage dlDownscaleColor2Gray_global ( const DLImage& imageData  );
00240 
00253    static DLImage dlDownscaleColor2Gray_weighted ( const DLImage& cImg, float rWt, float gWt, float bWt ); 
00254 
00270    static DLImage dlDownscaleColor2Binary_threshold( const DLImage& tImg, int rThresh = 100, int gThresh = 100, int bThresh = 100);
00271 
00285    static DLImage dlDownscaleColor2Binary_percentThreshold( const DLImage& tImg, double percent);
00286 
00300    static DLImage dlDownscalePercentThresholdBinarization( const DLImage& tImg, int percent);
00301 
00314    static DLImage dlDownscale256Color_global ( const DLImage& image_in, bool & quantized );
00315 
00333    static DLImage dlDownscaleYCrCbBinarization( const DLImage& tImg);
00334 
00335 };//end class
00336 
00337 #endif //_DLBITSPERPIXELCONVERTER_H_

DOCLIB is being developed under contract by a collaboration between:
The Laboratory for Language and Media Processing
Unviersity of Maryland, College Park
and
Booz | Allen | Hamilton

All Rights Reserved, 2003-2007