1 / 49

Histograms and Matching

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.

morag
Download Presentation

Histograms and Matching

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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;

  10. Create Histogram 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; 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;

  17. Histograms and Matching Basic Manipulations with Histograms

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

  19. More Operations

  20. Example  Graylevel Histogram

  21. Example  Graylevel Histogram Download Test Program

  22. Histograms and Matching Color Spaces

  23. Color Spaces

  24. RGB Color Space

  25. HSV Color Space

  26. YCbCr Color Space

  27. YCbCr Color Space

  28. Article Color Space Conversion Some Algorithms Applet

  29. OpenCV Color Space Conversion 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 Example  Hue-Sat Histogram

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

  38. 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

  39. 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

  40. 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

  41. Histogram Comparisons in OpenCV

  42. Histograms and Matching Back Projection

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

  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

  47. Patch-Based Projection

  48. Patch-Based Projection

  49. Patch-Based Projection

More Related