Histograms and Matching
490 likes | 784 Vues
Histograms and Matching. 主講人:虞台文. Content. Overview Basic Histogram Structure Accessing Histograms Basic Manipulations with Histograms Color Spaces Histogram Comparisons Back Projection. Histograms and Matching. Overview. Histograms. Histogram of an Image. Histogram for Skin Color.
Histograms and Matching
E N D
Presentation Transcript
Histograms and Matching 主講人:虞台文
Content • Overview • Basic Histogram Structure • Accessing Histograms • Basic Manipulations with Histograms • Color Spaces • Histogram Comparisons • Back Projection
Histograms and Matching Overview
Applications • Object Detection • Image Retrieval • Gesture Recognition
Histograms and Matching Basic Histogram Structure
CvHistogram Multidimensional Histograms typedef struct CvHistogram { int type; CvArr* bins; float thresh[CV_MAX_DIM][2]; // for uniform histograms float** thresh2; // for nonuniform histograms CvMatND mat; // embedded matrix header // for array histograms } CvHistogram;
Create Histogram CvHistogram* cvCreateHist( int dims, int* sizes, int type, float** ranges = NULL, int uniform = 1 );
Defer Set Ranges Used when calling cvCreateHist with ranges = NULL.
Histograms and Matching Accessing Histograms
Direct Access of Bin Data typedef struct CvHistogram { int type; CvArr* bins; float thresh[CV_MAX_DIM][2]; // for uniform histograms float** thresh2; // for nonuniform histograms CvMatND mat; // embedded matrix header // for array histograms } CvHistogram; hist->mat.data.fl
Direct Access of Histogram Information typedef struct CvHistogram { int type; CvArr* bins; float thresh[CV_MAX_DIM][2]; // for uniform histograms float** thresh2; // for nonuniform histograms CvMatND mat; // embedded matrix header // for array histograms } CvHistogram;
Histograms and Matching Basic Manipulations with Histograms
Calculate Histogram void cvCalcHist( IplImage** image, CvHistogram* hist, int accumulate=0, const CvArr* mask=NULL );
Example Graylevel Histogram Download Test Program
Histograms and Matching Color Spaces
Article Color Space Conversion Some Algorithms Applet
OpenCV Color Space Conversion void cvCvtColor( const CvArr* src, CvArr* dst, int code )
Download Test Program Example Hue-Sat Histogram
Histograms and Matching Histogram Comparisons
Histogram Comparisons in OpenCV #define CV_COMP_CORREL 0#define CV_COMP_CHISQR 1#define CV_COMP_INTERSECT 2#define CV_COMP_BHATTACHARYYA 3
Histogram Comparisons in OpenCV Correlation Method (CV_COMP_CORREL) maximum mismatch perfect match #define CV_COMP_CORREL 0 #define CV_COMP_CHISQR 1 #define CV_COMP_INTERSECT 2 #define CV_COMP_BHATTACHARYYA 3
Histogram Comparisons in OpenCV Chi-square Method (CV_COMP_CHISQR) perfect match bad mismatch #define CV_COMP_CORREL 0 #define CV_COMP_CHISQR 1 #define CV_COMP_INTERSECT 2 #define CV_COMP_BHATTACHARYYA 3
Histogram Comparisons in OpenCV Intersection Method (CV_COMP_INTERSECT) H1 and H2 are normalized to one before comparing total mismatch perfect match #define CV_COMP_CORREL 0 #define CV_COMP_CHISQR 1 #define CV_COMP_INTERSECT 2 #define CV_COMP_BHATTACHARYYA 3
Histogram Comparisons in OpenCV BHATTACHARYYA Method (CV_COMP_BHATTACHARYYA) perfect match total mismatch #define CV_COMP_CORREL 0 #define CV_COMP_CHISQR 1 #define CV_COMP_INTERSECT 2 #define CV_COMP_BHATTACHARYYA 3
Histograms and Matching Back Projection
Back Projection • Back projection is a way of recording how well the pixels or patches of pixels fit the distribution of pixels in a histogram model • cvCalcBackProject() • cvCalcBackProjectPatch()
Back Projection • Back projection is a way of recording how well the pixels or patches of pixels fit the distribution of pixels in a histogram model • cvCalcBackProject() • cvCalcBackProjectPatch()
Example Download Test Program