Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

calcHist() with CV_32F

$
0
0
Hello, To compute a histogram of a CV_8U image (values between 0 and 255) knowing that the upper boundary in `histRange` is exclusive, we have int histSize = 256; float range[] = { 0, 256 } ; const float* histRange = { range }; calcHist( &image, 1, 0, Mat(), histogram, 1, &histSize, &histRange ); Now assume I have an CV_32F image with values between (and including) 0 and 255 and I want to build a histogram with histSize = 1000. If the upper boundary of histogram ranges is exclusive then how to specify it properly not to lose the maximum value (255)? I tried the code below but I'm not sure if I'm right int histSize = 1000; float binSize = (255 - 0) / histSize; float range[] = { 0, 255 + binSize } ; const float* histRange = { range }; calcHist( &image, 1, 0, Mat(), histogram, 1, &histSize, &histRange );

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>