Ask Your Question

Colour recognition after an image is captured

asked 2014-04-23 08:22:12 -0500

luckyqiqi gravatar image

updated 2014-04-23 08:28:31 -0500

Hello, I'm a beginner on OpenCV. Currently, I'm working on how to recognize object's colour after an image is captured. I have done camera part where an image is successfully captured, then the screen will direct to "discard" and "save". My work should be like this, once i clicked "save", the system should process the image and the result should output the colour of image is "red", "blue", or "green". So, what I should do in protected void onActivityResult(int requestCode, int resultCode, Intent data)?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-04-23 18:44:16 -0500

lpb gravatar image

are you referring to finding the prominent color in an image and selecting between green, red or blue?

for a first step, you can get the color distribution (histogram) of your image by using calcHist

edit flag offensive delete link more


you're right, lpb. I'm working on the prominent colors and the result should output some string after dominant color is recognized among red, green and blue. I'm trying to understand and working around on Histogram calculation. Before that, the image was captured by camera and I retrieved it as bitmap, so am I right that I have to convert it to mat in order to proceed histogram calculation?

luckyqiqi gravatar imageluckyqiqi ( 2014-04-23 20:34:27 -0500 )edit

Question Tools


Asked: 2014-04-23 08:22:12 -0500

Seen: 250 times

Last updated: Apr 23 '14