Click here to Skip to main content
14,427,818 members
Rate this:
Please Sign up or sign in to vote.
See more:
I would like to detect color on an entire image, instead of just doing this in a specific place, so that the app can tell if the color exists on the entire image.
I am using openCV for android.
Thanks.


What I have tried:

I currently have an application that detects colors with openCV, but on touch, and I need to change this and detect colors on an entire image with an interval.
Thanks.
Posted
Updated 21-May-18 21:54pm
Comments
David Crow 7-May-18 13:31pm
   
Okay, and? Do you have code that needs critiqued or reviewed? Is your code throwing an error and you need help tracking it down? Be specific.
Member 10850253 7-May-18 13:33pm
   
I have no error, I just don't know how to convert my code from ontouch to entire image.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Unfortunately, OpenCV doesn't provide any sort of indication as to the color space in the IplImage structure, so if you blindly pick up an IplImage from somewhere there is just no way to know how it was encoded. Furthermore, no algorithm can definitively tell you if an image should be interpreted as HSV vs. RGB - it's all just a bunch of bytes to the machine (should this be HSV or RGB?). I recommend you wrap your IplImages in another struct (or even a C++ class with templates!) to help you keep track of this information. If you're really desperate and you're dealing only with a certain type of images (outdoor scenes, offices, faces, etc.) you could try computing some statistics on your images (e.g. build histogram statistics for natural RGB images and some for natural HSV images), and then try to classify your totally unknown image by comparing which color space your image is closer to.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100