Skip to content Skip to sidebar Skip to footer

Detect Values Of RGB From CameraFrame Using OpenCV In Android

I want to detect which value is maximum from RGB. how can I detect that? I want to display which colour has highest occurrence with their RGB value. For example, In a image the RE

Solution 1:

For such tasks you should use AsyncTask as it does not run on MainThread thus your UI wont freeze.

https://developer.android.com/reference/android/os/AsyncTask.html

I assume that this will be faster compared to your current solution.


Solution 2:

Split the image into its R, G and B channels, and compute the sum of each Mat.

vector<Mat> channels;
split(mRgba, channels);
B = sum(channels[0])[0];
G = sum(channels[1])[0];
R = sum(channels[2])[0];

Compare the values of R, G and B to know which colour has occurred the most in the frame.


Post a Comment for "Detect Values Of RGB From CameraFrame Using OpenCV In Android"