How to find average pixel value of an grayscale image in c++?
I'm going to classify the image into black or not. So i have to find the average pixel value of the image..
I'm going to classify the image into black or not. So i have to find the average pixel value of the image..
we can use:
Scalar m = cv::mean(img);
Mat bin = img > m[0]; // syntax sugar for 'threshold()'
but better, opencv has an automatic threshold method:
Mat bin;
cv::threshold(img, bin, 0, 255, THRESH_OTSU);
Asked: 2018-08-04 02:22:19 -0600
Seen: 19,122 times
Last updated: Aug 04 '18
Licence plate detection with different backgrounds
How to use BOW file for testing
How to make a hue distance histogram ?
How can I write numbers inside the detected circles on the image when using Hough Circle Transform?
I cannot load my training descriptors in memory [closed]
OpenCL Errors in the Console when using Stitcher OpenGL 3
really ??? please explain, why you think, you need the average for this.If the average will be lesser than a specific value (eg: 100) then i can realize that this image has more black shades and i can classify this.If its like 0 to 30 then i can consider it as black image in humans view.
Do you know any other method to find whether the image is black or not?