I want to know the percentage of RGB color from the PC camera's captured image

Hello,I am beginner of OpenFrameworks(several years ago I study for book).
I want to know the percentage of RGB color from the PC camera’s captured image.
I heard using a OpenCV.but I cannot understand…
which library is Do feasible,
Please tell me if there is a sample code.

There is an ofxOpenCv example in the openFrameworks example/addons/ folder that shows how to grab video/camera input - and there’s ofxCv by Kyle McDonald https://github.com/kylemcdonald/ofxCv an opencv addon that is packed with nice examples :slight_smile:


I don’t think OpenCV is necessary unless it provides a specific method for that purpose.

Correct me if i am wrong but i would just grab an image from the camera as an ofImage for example using ofVideoGrabber. ofImage is an array of RGB values of type unsigned char which varies between 0 and 255. R, G and B values are consecutives in the array, that is array[0] = Red value for pixel 1, array[1] = Green value for pixel 1, array[2] = Blue value for pixel 1, array[3] = Red value for pixel 2… and so on.

so grab values for each color (in a for loop using index + 3) and compute percentage