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.