Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect Color Code of live android camera preview

I would like to detect colorcode of image (live stream image) while camera preview is going on. I want to develop sample android application which works like ColorGrab android application. Please find attached screenshot for the same.

How can I make demo program application which capture and recognize colors simply by pointing the camera and show as hexcode of that color.

Any help would be appreciated. Thanks for your time.

enter image description here

like image 421
ojas Avatar asked May 28 '15 17:05

ojas


People also ask

Is there an app that detects colour?

Swatches app identifies the colors of whatever your phone camera points to - Curbed.

How do cameras identify colors?

Picklor: Camera Color Picker is a free application for Android devices that you can make use of to identify any color using the device's built-in camera.

Can Google lens identify colors?

Many of the features Google Lens delivers already exist, but they're tucked inside individual apps. For example, you can install apps on an iPhone or Android device today that use the camera to: Identify colors (Color Name, Color Grab)


1 Answers

https://play.google.com/store/apps/details?id=com.raj.colorwalls

Look at this app url, it should give you some idea. It uses this code:

int frameHeight1 = camera.getParameters().getPreviewSize().height;
    int frameWidth1 = camera.getParameters().getPreviewSize().width;
    int rgb1[] = new int[frameWidth * frameHeight];
    decodeYUV420SP(rgb1, data, frameWidth, frameHeight);
    Bitmap bmp1 = Bitmap.createBitmap(rgb, frameWidth1, frameHeight1, Config.ARGB_8888);
    int pixel = bmp1.getPixel( x,y );
    int redValue1 = Color.red(pixel);
    int blueValue1 = Color.blue(pixel);
    int greenValue1 = Color.green(pixel);
    int thiscolor1 = Color.rgb(redValue1, greenValue1, blueValue1);

enter image description here

like image 94
raj Avatar answered Oct 28 '22 13:10

raj