Values of cv.mean()

Hello, I am using opencv.js.
I’m wondering what cv.mean() actually measures? Is it light intensity or pixel values or something else? In my application I use it to measure values of LED:s turning on and of and the values vary from 190-80 approx.

what difference do you make between light intensity and pixel values?
sensor

cv::mean doc

Pixel values (from what I know) are values between 0-255 for 3-channel RGB images and light intensity [candela] are values of brightness in a particular direction. I mainly want to be correct in my presentation of the project I’m working with. In the documentation from opencv that you linked it only says “calculate mean value of array” and I feel like it has to be the mean value of something?

the average value of a matrix (full stop !)

the concept is not restricted to images/pixels but also applies to radiation distribution or force fields or neural network weights

Okay thanks! Since I’m just doing meanVal=cv.mean(area) on an area of a video were the light is changing, how can I determine what the values in the array meanVal is?

what do you mean ? (ehe)
you receive a Scalar with 1 mean value per image channel. – and ?

have you read wikipedia link? I think principle is well described.

if the result is a Scalar value, you can access its elements like so:

Yeah I did, made me understand the concept better!

I’m trying to put a unit on the values appended to the array from cv.mean(), but maybe there Isn’t one. From the values I have in the array (~80 for dark gray and ~190 for light gray) I’m starting to believe that it is pixel values.

You cannot put unit without calibration. If you want to calibrate it means you will need a monochromatic light and calibrate all pixels. Then you have to change wavelength and start again. Once finished you need to check sensor linearity versus time integration (shutter). Once is finished you will need to change room temperature and start linearity versus temperature . I think I can forget some things :grin:

1 Like