Motion - Feature Request 2010x 11x 02x 052456

Feature Request: Virtual light sensor from the image


It would be great, if motion will have conversion specifier which implies a value of current light. For example ,my picture is 528x432 pix, on php I has this code:


$image = imagecreatefromjpeg("last.jpg");

for($y=0; $y<432; $y++)


for($x=0; $x < 528; $x++)


$rgb = imagecolorat($image, $x, $y);

$total += $rgb;



$result = round($total / 228096, 0);

$current_light = round($result / 1000000, 2);


If now the day in my room light , $current_light is about 3 .. 6 , if now evening , twilight, $current_light is about 1.5 ... 3 , if night < 1.5

-- StPavel - 02 Nov 2010

Follow up


Unfortunately cameras usually have agc (automatic gain control). This will multiply the detected values by 2x,4x,etc. This would introduce sudden current_light changes. You can only guess the agc current value e.g. if all lower bit is 0, then it must be at least agc x2...

-- LaszloVarga - 25 Jan 2011
Topic revision: r2 - 25 Jan 2011, LaszloVarga
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.