I would like to get the average R, G, and B values from a captured image on the OpenMV. The get_statistics method only returns average values in the LAB color space. However, I would like the average values in the RGB565 color space. The histogram in the IDE is able to calculate the average RGB values, so clearly the numbers are there. I just want to be able to access them in code.
Results of the image_statistics_info.py example code with RGB565 pixformat:
Is that equivalent? Is the average R, G, B, value equal to the average LAB value converted to a RGB format? I couldn’t find documentation to confirm this.
Print From Code ||||| From Histogram in IDE
(165,158,156) ||||| (164, 162, 155)
(33, 44, 24) ||||| (38, 48, 26 )
(57, 52, 66) ||||| (60, 57, 69 )
According to previous forum posts its because of some conversion error? If so, which one is accurate?
Yeah, it’s not exact. Note that the IDE is working off of a JPEG image. Do not expect to get exactly the same values. However, it should be good enough for whatever you need to do.
The OV* camera line isn’t really that high quality on the RGB parts. Also, remember the image is RGB565 so it’s +/-8 points is expected.
Thanks! I still can’t find any docs to suggest that the average of LAB values converted to RGB is the same as the average of RGB values. In fact, looking at the conversion process it seems like it isn’t. Is there a source to confirm that the averaging is equivalent?
Just to confirm, the IDE works off JPEG, but the code should work off the raw RGB right? I just want to confirm that calling histogram.get_statistics() inside the code gives the averages of the raw RGB, and not the JPEG like the IDE.
For my application I need raw RGB averages instead of the average of the JPEG. If the code does that then it’s perfect!