For a project I want to use a USB-camera (https://www.e-consystems.com/ar0330-lowlight-usb-cameraboard.asp) as a Lux-meter. I control the camera using v4l2 on Linux. I have a real lux-meter (https://gossen-photo.de/en/mavo-spot-2-usb) at hand so I can get "real" readings and confirm/crosscheck those made by my DYI Lux-meter.
I followed a guide about doing exactly this found at http://www.conservationphysics.org/lightmtr/luxmtr1.php which states as a formula:
Lux = 50x fnumber squared / (exposure time in seconds x ISO film speed)
There is no ISO setting so I guess the ISO is fixed. So I use the real lux-meter to get the lux of a certain spot and change the formula to
ISO = 50x fnumber squared / (Lux x exposure time in seconds)
to get the "fixed" ISO and I get a number of approximately 450.
From the camera I get an 8bit grayscale image. So I take the value of a pixel which I want to measure the lux and map it to a number between 0.0 and 1.0 and multiply that by the lux from the main formula:
Lux = pixel x 50 x fnumber squared / (exposure time in seconds x ISO film speed)
But the readings do not match the real lux-meters values. They seem to be correct for low-lux values but error increases exponentially with brighter spots that are measured.
Has anyone ever done something similar? Did I miss something?
Thanks for any advice.
EDIT update after answer below
Thanks to Michael's help and information found on https://en.wikipedia.org/wiki/Exposure_value#EV_as_a_measure_of_luminance_and_illuminance I'm at these formulas right now:
EV calculation, 2.17 being the compensation for ISO 450
float ev = log2(pow(fNumber, 2.0) / expTimeSeconds) + 2.17;
LUX calculation, pixelBrightness being a value between 0.0 (black) and 1.0 (white)
float lux = 2.5 * pow(2, ev) * pixelBrightness;
Weirdly, currently I get way to high Lux values, ranging aroung 1200 Lux for office indoors indirect lighting?
2nd EDIT update
So I was mistaking Lux and cd/m2 resp. illumination and lumination all the time - the Mavo-Spot 2 that I thought was a Lux-meter really is a "high precision luminance meter" that "measures the perceived brightness of back-lighted surfaces in candelas per square meter (cd/m²) or foot-lamberts (fL) in consideration of ambient light".
So I was trying to measure Lux with my camera but comparing the values to the ones I got from the Mavo Spot 2 which are cd/m2.
I am now using the formulas originally found in an old article (http://www.conservationphysics.org/lightmtr/luxmtr1.php):
float luminance = 12.4 * pow(fNumber, 2) / (expTimeSeconds * isoValue);
float lux = 50 * pow(fNumber, 2) / (expTimeSeconds * isoValue);
Of course the values are strongly simplified as they do not account for object material and reflectivity.
Answer
Did I miss something?
Yes. The article you cite and upon which your entire project seems to be based does not require a photo to be taken and measured. The article is from the film age before digital imaging was anything but a lab exercise for anyone other than NASA and their deep space probes. It doesn't even require film to be in the camera. It is based entirely on the reading obtained using the camera's light meter to measure reflected light from the subject.
The fact that the camera is converting the linear response of the sensor to the logarithmic response we humans see with. For what you are trying to do to work, you need to use a camera that will output the actual linear values of the raw sensor output before gamma correction curves (not the same thing as gamma correction for monitors - that's much further down the imaging pipeline) have been applied.
It would probably be much simpler to convert a measured exposure value (EV) to lux.
For more about how to do that, please see:
How to calculate Lux from EV?
Recalculating lux or lm from EV
And over at Stack Overflow: How to convert between lux and exposure value?
Won't I need raw image data to calculate lux from EV?
Not if the camera gives you that data independently of the image information. In the EXIF info of a jpeg, for instance.
If you know the ISO, Tv, and Av used, calculating the EV from those three numbers is trivial. If the camera's FoV is uniform with regard to brightness, such as when a test card fills the frame, it's a pretty easy solution. Do note that as the accepted answer to the first linked question above states, it only works if you always use a target with the same reflectance to compare reflected light (what your camera's meter measures in EV) to incident light (the brightness of the light shining on the subject measured in Lux). You also assume the camera's metering profile is aiming for 18% gray, but that can all be calibrated using your actual Lux meter.
For more about what EV really is (it's a light agnostic set of equivalent Tv/Av combinations that give the same exposure and only indicates a specific light level if we also assume a specific sensitivity, usually ISO 100, and a proper exposure of an 18% grey object), you might find this answer helpful.
From deep within the Wikipedia article for EV:
Strictly, EV is not a measure of luminance or illuminance; rather, an EV corresponds to a luminance (or illuminance) for which a camera with a given ISO speed would use the indicated EV to obtain the nominally correct exposure. Nonetheless, it is common practice among photographic equipment manufacturers to express luminance in EV for ISO 100 speed, as when specifying metering range (Ray 2000, 318) or autofocus sensitivity. And the practice is long established; Ray (2002), 592) cites Ulffers (1968) as an early example. Properly, the meter calibration constant as well as the ISO speed should be stated, but this seldom is done.
From the comments:
I can read out absolute exposure time and I know the f-number of the lens. According to Wikipedia the EV is calculated like log2(f-number squared / shutter time in seconds). So I only need to adapt it to ISO 450?
Yes. Don't forget that ISO is also a logarithmic scale. ISO 450 is not 4.5 EV offset from ISO 100. It's more like 2.17 EV difference (because 22.17 = 4.5).
I don't get how to adapt to ISO 450 ... how do I get from the EV that I get for ISO 100 to the value for ISO 450?
You don't get from the value for ISO 100 to the value for ISO 400. You do the reverse.
The camera is giving you Tv (time value = exposure time) and Av (aperture value) based on ISO 450. You need to convert that to ISO 100. If the Tv and Av used by the camera is EV450 10, then you need to add 2.17 to get EV100 12.17. Since the EV scale is already logarithmic, you only need to add/subtract the number of stops difference to convert an EV from one ISO to another.
No comments:
Post a Comment