Presentation is loading. Please wait.

Presentation is loading. Please wait.

Histograms and Matching 主講人:虞台文. Content Overview Basic Histogram Structure Accessing Histograms Basic Manipulations with Histograms Color Spaces Histogram.

Similar presentations


Presentation on theme: "Histograms and Matching 主講人:虞台文. Content Overview Basic Histogram Structure Accessing Histograms Basic Manipulations with Histograms Color Spaces Histogram."— Presentation transcript:

1 Histograms and Matching 主講人:虞台文

2 Content Overview Basic Histogram Structure Accessing Histograms Basic Manipulations with Histograms Color Spaces Histogram Comparisons Back Projection

3 Histograms and Matching Overview

4 Histograms

5 Histogram of an Image

6 Histogram for Skin Color

7 Applications Object Detection Image Retrieval Gesture Recognition

8 Histograms and Matching Basic Histogram Structure

9 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; 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;

10 Create Histogram CvHistogram* cvCreateHist( int dims, int* sizes, int type, float** ranges = NULL, int uniform = 1 ); CvHistogram* cvCreateHist( int dims, int* sizes, int type, float** ranges = NULL, int uniform = 1 );

11 Defer Set Ranges Used when calling cvCreateHist with ranges = NULL.

12 Clear and Release Histogram

13 Histograms and Matching Accessing Histograms

14 Access Bin Data

15 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; 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

16 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; 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;

17 Histograms and Matching Basic Manipulations with Histograms

18 Calculate Histogram void cvCalcHist( IplImage** image, CvHistogram* hist, int accumulate=0, const CvArr* mask=NULL ); void cvCalcHist( IplImage** image, CvHistogram* hist, int accumulate=0, const CvArr* mask=NULL );

19 More Operations

20 Example  Graylevel Histogram

21 Download Test Program Download Test Program

22 Histograms and Matching Color Spaces

23

24 RGB Color Space

25 HSV Color Space

26 YCbCr Color Space

27

28 Color Space Conversion Article Some Algorithms Applet

29 OpenCV  Color Space Conversion void cvCvtColor( const CvArr* src, CvArr* dst, int code ) void cvCvtColor( const CvArr* src, CvArr* dst, int code )

30 Skin Color Detection by HSV and RGB

31 Automatic Face Detection

32 Histogram Usage Examples

33 Example  Hue-Sat Histogram

34 Download Test Program Download Test Program

35 Histograms and Matching Histogram Comparisons

36 Histogram Comparisons in OpenCV #define CV_COMP_CORREL 0 #define CV_COMP_CHISQR 1 #define CV_COMP_INTERSECT 2 #define CV_COMP_BHATTACHARYYA 3

37 Histogram Comparisons in OpenCV #define CV_COMP_CORREL 0 #define CV_COMP_CHISQR 1 #define CV_COMP_INTERSECT 2 #define CV_COMP_BHATTACHARYYA 3 Correlation Method (CV_COMP_CORREL) maximum mismatch perfect match

38 Histogram Comparisons in OpenCV #define CV_COMP_CORREL 0 #define CV_COMP_CHISQR 1 #define CV_COMP_INTERSECT 2 #define CV_COMP_BHATTACHARYYA 3 Chi-square Method (CV_COMP_CHISQR) bad mismatch perfect match

39 Histogram Comparisons in OpenCV #define CV_COMP_CORREL 0 #define CV_COMP_CHISQR 1 #define CV_COMP_INTERSECT 2 #define CV_COMP_BHATTACHARYYA 3 Intersection Method (CV_COMP_INTERSECT) total mismatch perfect match H 1 and H 2 are normalized to one before comparing

40 Histogram Comparisons in OpenCV #define CV_COMP_CORREL 0 #define CV_COMP_CHISQR 1 #define CV_COMP_INTERSECT 2 #define CV_COMP_BHATTACHARYYA 3 BHATTACHARYYA Method (CV_COMP_BHATTACHARYYA) total mismatch perfect match

41 Histogram Comparisons in OpenCV

42 Histograms and Matching Back Projection

43 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()

44 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()

45 cvCalcBackProject

46 Example Download Test Program Download Test Program

47 Patch-Based Projection

48

49


Download ppt "Histograms and Matching 主講人:虞台文. Content Overview Basic Histogram Structure Accessing Histograms Basic Manipulations with Histograms Color Spaces Histogram."

Similar presentations


Ads by Google