Results 1 to 10 of 11

Thread: Using Webcam as Ambient Light Sensor

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Beans
    36
    Distro
    Ubuntu 9.10 Karmic Koala

    Question Using Webcam as Ambient Light Sensor

    Hi all. I have done some extensive searching and haven't been able to come up with anything to solve this quest yet.

    I would like to be able to use my webcam as an ambient light sensor to automatically adjust my backlight brightness on my laptop. I have a Dell XPS M12010, with the Logitech webcam built in. I am running Ubuntu 8.04. My webcam is working and shows up at /dev/video0. I know gnome-power-manager can do this, and I have seen the gconf-editor settings for the ambient light sensor, but when I change these settings nothing happens.

    If anybody has some helpful advice, or can point me somewhere else it would be most appreciated!

    Thanks!

    - ionman

  2. #2
    Join Date
    Aug 2006
    Beans
    36
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Using Webcam as Ambient Light Sensor

    Has anyone had any success doing this?

  3. #3
    Join Date
    Jun 2009
    Location
    Brighton, UK
    Beans
    1
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Using Webcam as Ambient Light Sensor

    Have you had any luck trying to get this working?
    I've been searching around recently, and there still doesn't seem to be a solution.
    Only thing I can find is redshift, which changes the screen warmth according to global position.

  4. #4
    Join Date
    Apr 2010
    Beans
    1

    Re: Using Webcam as Ambient Light Sensor

    I found this: a formula to calculate the brightness. I not good in writing apps so I am not able to do anything with it, but maybe someone else is able to use it

    http://social.msdn.microsoft.com/For...e-bcc8609951d2

  5. #5
    Join Date
    Oct 2009
    Location
    here and there...
    Beans
    67
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Using Webcam as Ambient Light Sensor

    It's funny how we all thought of this at the same period of time.
    I've done something but it's in a serious alpha state and it's tested only with my asus x55sv laptop.
    It uses quite a lot of things but it's fine with me for the moment as I already had most of them installed.

    Requires:
    + webcam (obviously)
    + streamer (to grab webcam image)
    + convert (to resize the image so there will be less pixels to be analysed)
    + php5-cli and php5-gd (to analyse each pixel - I didn't know any other method of analysing the brightness)
    + changing the permissions of the brightness file (sudo chmod 777 $file) which in my case is: /sys/class/backlight/acpi_video0/brightness but for you it might be other so you might have to modify it in the script (I wrote in the script where you have to replace the path)


    Archive description:
    + RUN.sh (it's the main bash script which has to be run)
    + ret-brightness.php (it's runned by the bash script so you don't have anything to do with this)
    + sleep-time (it's the sleep time in seconds between 2 webcam grabs)


    How to kill the script:
    Method 1: If you run from a terminal just CTRL + C
    Method 2: rm /tmp/auto-brightness-* (run this in terminal, it will remove a flag created by the script. It will still run the remaining sleep time but when the next webcam grab comes it exits)


    In my opinion this is at least a start... I didn't find anything through the internet to do this so I'm quite happy with this.. even if it's a mess
    Attached Files Attached Files
    Last edited by blchinezu; August 21st, 2010 at 09:19 AM. Reason: reuploading archive... made quick improvement

  6. #6
    Join Date
    Oct 2009
    Location
    here and there...
    Beans
    67
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Using Webcam as Ambient Light Sensor

    I made it better than what i've attached in the upper post. But it's still a beta.
    Anyway... The configuration is way more easier as I made a separate cfg.ini file. Easy to use and understand. (at least I hope so).

    Link: http://gnome-look.org/content/show.php/Webcam+Adjust+Screen+Brightness?content=128780

    Good Luck

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •