MATLAB Answers

Brightness measurement with the webcam

7 views (last 30 days)
Is possible to make this with the webcam?, any suggestion is well accepted. Thanks!

Accepted Answer

Walter Roberson
Walter Roberson on 23 May 2011
You need to calibrate with sources of known intensities at known distances.
You should expect that your webcam is non-linear in its brightness response. If it is a cheap webcam, there is also a good possibility that there are notable non-linearities across the imaging sensor, and there is an even better chance that the lens does not focus linearly.
You should also not trust the higher-end or lower-end readings: at the lower end you will get quantum noise producing false pixels, and at the upper end brightnesses past a certain point will saturate the sensor. Don't be surprised if the saturation effects start below full brightness.
Remember to let everything warm up for at least 4 hours (24 preferred) and remember to re-do the calibrations against all the environmental temperatures the equipment might be exposed to, and remember to include a digital thermometer as one of the sensors so that you know which temperature profile to use.
And keep in mind that unless you know the exact distance to the object you are trying to measure the brightness of, you will only get relative brightness and not absolute luminosity.
Oh yes: be sure to do the tests over a range of colors, as webcams usually have non-linear color filters in them. See
In summary: if you want the results to be more than a vague approximation, you probably want to use better equipment.
Image Analyst
Image Analyst on 5 Jun 2011
Walter has some excellent suggestions. For a known standard, we use the x-rite ColorChecker charts:
Some other charts:
For utmost accuracy you need to do a lot of things that aren't necessary just for some quick and dirty comparisons, like determining the "opto-electronic conversion function" ("gamma") of the camera, compensating for vignetting (shading), doing a color correction, etc. Read the "Gamma FAQ" here (Lots of good info on that site.)
And you'll need a scientific grade camera, not a consumer or prosumer camera since they always add "stuff" to the image to try to fix it up and make it more pleasing (e.g. adding gamma, noise correction, edge sharpening, color saturation, color models, different demosaicing algorithms, etc.). So you'd have to work with the raw image to get around all that, but even the raw image may have some amount of "fixing up" done, for example dead pixel replacement. Like Walter said, warming up is a crucial and often ignored factor. You can get a recording light meter from Extech to see when your light exposure "flattens out" and stabilizes. I find it takes 2 hours for an incandescent lamp and half an hour for LED lighting or fluorescent lamps with optical feedback. The best way to correct your images back to "Time zero" is to have an intensity standard internal to your image (actually in the field of view). That way you can measure it and figure out what the values are, what they should be, and create a transform to fix your image. To do a background or shading correction, you need to do a background division (usually) or background subtraction (sometimes, e.g. in radiology). To determine the OECF, (gamma) you need to present a series of different gray cards that take up the whole frame. You might be able to get by with presenting a gray scale step wedge (like in the xrite Color Checker chart) provided you have a good background correction already in place otherwise the shading will alter what the gray values should be. Here's a ref

Sign in to comment.

More Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!