Book Image

OpenCV Essentials

Book Image

OpenCV Essentials

Overview of this book

Table of Contents (15 chapters)
OpenCV Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Image histogram


An image histogram represents the frequency of the occurrence of the various gray levels or colors in the image, in case of 2D and 3D histograms respectively. Therefore, the histogram is similar to the probability density function of the different pixel values, that is, the gray levels, present in the image. In OpenCV, the image histogram may be calculated with the function void calcHist(const Mat* images, int nimages, const int* channels, InputArray mask, OutputArray hist, int dims, const int* histSize, const float** ranges, bool uniform=true, bool accumulate=false). The first parameter is a pointer to the input image. It is possible to calculate the histogram of more than one input image. This allows you to compare image histograms and calculate the joint histogram of several images. The second parameter is the number of source images. The third input parameter is the list of the channels used to compute the histogram. It is possible to calculate the histogram of more than...