Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Access histogram data

Hello,

How do I extract actual histogram data (bin value)?. I am a bit confused, because after computing a histogram with cv::calcHist, the matrix size (rows, cols) appears to be -1,-1. However, the cv::compareHist seems to correctly tell that similar images have a small CHI2 distance, and different images have a large CHI2 value.

Thanks

Access histogram data

Hello,

How do I extract actual histogram data (bin value)?. I am a bit confused, because after computing a histogram with cv::calcHist, the matrix size (rows, cols) appears to be -1,-1. However, the cv::compareHist seems to correctly tell that similar images have a small CHI2 distance, and different images have a large CHI2 value.

int bins = 4;
int histSize[] = {bins, bins, bins};
float rranges[] = { 0, 255 }, granges[] = { 0, 255 }, branges[] = { 0, 255 };
const float* ranges[] = { rranges, granges, branges };
int channels[] = {0, 1, 2};
cv::calcHist( &im, 1, channels, mask, hist, 3, histSize, ranges, true, false );

Thanks