Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Color Detection Using Android Camera

currently embarking on a project regarding android cameras that would require me to detect certain colours during live preview or after the picture is taken.

I've managed to successfully set up the camera with live preview and all, but I'm currently stuck at detecting the colours. For example, I would like to detect green colour during the camera's live preview and send a feedback to the user. It doesn't necessarily need to be done during live preview, as I've been thinking that snapping a photo, then doing the colour detection could be accomplished in an easier manner.

I'm a complete newbie about android programming, so any kind of direction regarding how to code out the colour detection algorithm would be greatly appreciated!

like image 520
Nyaato Avatar asked Nov 12 '11 12:11

Nyaato


People also ask

Is there an app to detect colours?

Dulux Colour allows you to sample a part of a photo and see the closest digital match from over 1,100 colours in the Dulux range. From there you can save the colour and use it in your colour schemes.

How do you find color on a camera?

Picklor makes the process of identifying colors using your Android camera as easy as possible. Basicially, all you do is point your camera at an object to identify colors. The color identifier changes as you move the camera around, and a tap on the capture button adds the current color to the app for safekeeping.

Which algorithm is used in color detection?

KMeans algorithm creates clusters based on the supplied count of clusters. In our case, it will form clusters of colors and these clusters will be our top colors. We then fit and predict on the same image to extract the prediction into the variable labels . We use Counter to get count of all labels.


2 Answers

"Color Grab" is an Android application that does what you need. The app has the best color detection/recognition algorithm and it works perfectly.You can check out how it works.

Color Grab on Google Play

like image 178
Becka Archer Avatar answered Nov 15 '22 01:11

Becka Archer


If you want to go for simple method then get bitmap image from camera and use bitmap.getpixel(int x,int y) to get the color and compare the pixels with the color that you want

like image 21
WSS Avatar answered Nov 15 '22 00:11

WSS