$search
00001 00004 //***************************************************************************** 00005 // Contrast Limited Adaptive Histogram Equalization (CLAHE) for OpenCV 00006 //----------------------------------------------------------------------------- 00007 // Original CLAHE implementation by Karel Zuiderveld, karel@cv.ruu.nl 00008 // in "Graphics Gems IV", Academic Press, 1994. 00009 //----------------------------------------------------------------------------- 00010 // Converted to OpenCV format by Toby Breckon, toby.breckon@cranfield.ac.uk 00011 // Copyright (c) 2009 School of Engineering, Cranfield University 00012 // License : LGPL - http://www.gnu.org/licenses/lgpl.html 00013 //----------------------------------------------------------------------------- 00014 // Improved by Shervin Emami on 17th Nov 2010, shervin.emami@gmail.com 00015 // http://www.shervinemami.co.cc/ 00016 //***************************************************************************** 00017 #ifndef __CLAHE_HEADER__ 00018 #define __CLAHE_HEADER__ 00019 00020 #include <cv.h> // open cv general include file 00021 00022 // ***************************************************************************** 00023 00024 // CLAHE input/output range flag definitions 00025 00026 #define CV_CLAHE_RANGE_FULL 0 00027 #define CV_CLAHE_RANGE_INPUT 1 00028 00029 // ***************************************************************************** 00030 00031 // cvAdaptEqualize(src, dst, xdivs, ydivs, bins) 00032 // 00033 // src - pointer to source image (must be single channel 8-bit) 00034 // dst - pointer to destination image (must be single channel 8-bit) 00035 // xdivs - number of cell divisions to use in vertical (x) direction (MIN=2 MAX = 16) 00036 // ydivs - number of cell divisions to use in vertical (y) direction (MIN=2 MAX = 16) 00037 // bins - number of histogram bins to use per division 00038 // range - either of CV_CLAHE_RANGE_INPUT or CV_CLAHE_RANGE_FULL to limit the output 00039 // pixel range to the min/max range of the input image or the full range of the 00040 // pixel depth (8-bit in this case) 00041 00042 void cvAdaptEqualize(IplImage *src, IplImage *dst, 00043 unsigned int xdivs, unsigned int ydivs, unsigned int bins, int range); 00044 00045 // cvCLAdaptEqualize(src, dst, xdivs, ydivs, bins, limit) 00046 // 00047 // src - pointer to source image (must be single channel 8-bit) 00048 // dst - pointer to destination image (must be single channel 8-bit) 00049 // xdivs - number of cell divisions to use in vertical (x) direction (MIN=2 MAX = 16) 00050 // ydivs - number of cell divisions to use in vertical (y) direction (MIN=2 MAX = 16) 00051 // bins - number of histogram bins to use per division 00052 // limit - contrast limit for localised changes in contrast 00053 // range - either of CV_CLAHE_RANGE_INPUT or CV_CLAHE_RANGE_FULL to limit the output 00054 // pixel range to the min/max range of the input image or the full range of the 00055 // pixel depth (8-bit in this case) 00056 00057 00058 void cvCLAdaptEqualize(IplImage *src, IplImage *dst, 00059 unsigned int xdivs, unsigned int ydivs, unsigned int bins, float limit, 00060 int range); 00061 00062 // ***************************************************************************** 00063 00064 /* 00065 redefine : CV_ERROR_LOCAL macro unconditionally raises error with passed code and message. 00066 After raising error, control will be transferred to the exit label. 00067 */ 00068 00069 #undef CV_ERROR 00070 #define CV_ERROR( Code, Msg ) \ 00071 { \ 00072 cvError( (Code), "CLAHE code", Msg, __FILE__, __LINE__ ); \ 00073 exit(1); \ 00074 } 00075 00076 // ***************************************************************************** 00077 00078 #endif