I am trying to detect if the picture(black and white sketch) is colored or not in the room conditions by a mobile camera.
I have been able to get this result
using following code
Mat dest = new Mat (sections[i].rows(),sections[i].cols(),CvType.CV_8UC3);
Mat hsv_image = new Mat (sections[i].rows(),sections[i].cols(),CvType.CV_8UC3);
Imgproc.cvtColor (sections[i],hsv_image,Imgproc.COLOR_BGR2HSV);
List <Mat> rgb = new List<Mat> ();
Core.split (hsv_image, rgb);
Imgproc.equalizeHist (rgb [1], rgb [2]);
Core.merge (rgb, sections[i]);
Imgproc.cvtColor (sections[i], dest, Imgproc.COLOR_HSV2BGR);
Core.split (dest, rgb);
How can I sucessfully find out if the image is colored or not. The color can be any and it has room conditions. Please help me on this as I am beginner to it.
Thanks
To process the colorful image in
HSV color-space
is a good direction. And I split the channels and find theS
channel is great. BecauseS
isSaturation(饱和度)
of color.Then threshold the
S
with thresh of100
, you will get this.It will be easy to separate the colorful region in the threshed binary image.
As @Mark suggest, we can use adaptive thresh other than the fixed one. So, add
THRESH_OTSU
in the flags.Core python code is presented as follow:
Related answers: