Detect Values of RGB from CameraFrame using OpenCV in Android

前端 未结 2 1398
广开言路
广开言路 2021-01-25 11:00

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

2条回答
  •  伪装坚强ぢ
    2021-01-25 11:43

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

    vector 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.

提交回复
热议问题