FedeDP / Clightd

A linux bus interface that lets you change screen brightness, compute captured webcam frames brightness and change screen temperature.
GNU General Public License v3.0
82 stars 10 forks source link

[FEATURE REQ] Tell Clight to use only a certain area of the camera #74

Closed patri9ck closed 2 years ago

patri9ck commented 3 years ago

When the lights on my room are turned off and I open a window with dark colors (like my terminal, which has a grey background), my monitor does not light up my room as much as when I open a window with bright colors (like Google Chrome, when I am on a website with a white background). Therefore Clight detects a brightness of 0.1 when I open up my terminal and a brightness of 0.9 when I open Google Chrome on a website with a white background.

One solution could be that the user is able to specify a certain area on the camera which Clight should use to calibrate all the things. For example only a few pixels on the upper right corner which are not affected by the monitor.

FedeDP commented 3 years ago

Hi! This is what SCREEN module is for: it compensates for screen-emitted brightness; it is highly simple but should work fine, at least it tries :)

Anyway, the suggestion is good! I can add a camera sensor specific parameter to let users specify the area used to compute ambient backlight, eg: something like: x: 0.4-0.6,y: 0.2,0.3 to only use X between 40% and 60% of image length, and Y between 20% and 30% (starting from top left), or something like that. Thanks for your input!

patri9ck commented 3 years ago

Thank you! I will take a look at the module.

FedeDP commented 3 years ago

Is SCREEN module working fine?

patri9ck commented 3 years ago

It's kinda working but it's to be honest not that satisfying.

FedeDP commented 3 years ago

I will try to add the new feature in the next clightd release cycle!

FedeDP commented 3 years ago

Move to Clightd.

FedeDP commented 3 years ago

Latest master should have cropping in place; it is a new sensor settings that can be used like this:

busctl call org.clightd.clightd /org/clightd/clightd/Sensor org.clightd.clightd.Sensor Capture "sis" "" 5 "x=0.4-0.6"
busctl call org.clightd.clightd /org/clightd/clightd/Sensor org.clightd.clightd.Sensor Capture "sis" "" 5 "x=0.4-0.6,y=0.4-0.6"

In the first case, all image height will be considered, but only central columns will be used (columns from 40% of image width to 60%). In the second case Clightd will use central 30% of image (ie: rows from 40% of image height to 60% and columns from 40% of image width to 60%).

Clightd tries to use v4l2 APIs where supported (both "new" selection API and "old" crop API, see https://www.kernel.org/doc/html/v4.14/media/uapi/v4l/crop.html and https://www.kernel.org/doc/html/v4.12/media/uapi/v4l/vidioc-g-selection.html). Unfortunately i could not test because none of my webcams supported them. In these cases, Clightd fallbacks at manually skipping pixels.

FedeDP commented 3 years ago

I forgot to mention that (0,0) origin value is top left corner.

FedeDP commented 2 years ago

The feature is now implemented in master since a couple of months; no feedback provided. Closing for now! Please, feel free to reopen this!

Ps: wiki was updated too: https://github.com/FedeDP/Clightd/wiki/Sensors#camera-1