disable color balancing on XO webcam

Anish Mangal anishmangal2002 at gmail.com
Mon Nov 1 08:29:34 EDT 2010


Hi,

I think it should be possible by using the v4l2 python bindings[1].
There are a few controllable knobs that the xo-1 camera provides
(don't know if its the same on xo-1.5). These are:

1. AGC (Auto gain control)
2. Gain
3. Exposure
4. Brightness
5. Contrast
6. Saturation

A typical python code for changing camera brightness would be [2]

[1] http://pypi.python.org/pypi/v4l2
[2] http://dpaste.org/iSa7/

--
Anish

P.S. I'm not sure if these settings are controllable directly through gstreamer.

On Mon, Oct 25, 2010 at 9:04 PM, Gary C Martin
<garycmartin at googlemail.com> wrote:
>
> Hi Sebatian,
>
> On 25 Oct 2010, at 15:28, sebarocker at gmail.com wrote:
>
> > Hi,
> >
> > Im working on a computer vision project in the XO and i would like to disable the color balancing on the XO webcam but i don't know how.
> > In this link http://wiki.laptop.org/go/Hardware_specification says that it is posible :)
>
> This reminded me of some distant email threads, here's a quick copy paste from my archive of them, in case any are of help.
>
> Regards,
> --Gary
>
> --- copy & paste 1 ---
>
> > From: Benjamin M. Schwartz <bmschwar at fas.harvard.edu>
> > Subject: Re: [Sugar-devel] [ASLO] webcam images and control
> > Date: 25 February 2010 16:46:29 GMT
> >
> > Aleksey Lim wrote:
> >> On Thu, Feb 25, 2010 at 03:39:26PM +0100, Emmanuel Di Folco wrote:
> >>> I would like to be able to :
> >>> - control the gain or integration time of the camera (mode Photo, not
> >>> video) in order not to saturate (this is obviously feasible, since
> >>> the images taken during the day are not saturated !)
> >>> - eventually restrict the size of the screen window that is
> >>> considered by the 'automatic gain adjustment algorithm' (where I
> >>> would insert the moon)
> >
> > The automatic gain adjustment is performed in hardware, not software.  In
> > the standard mode, the CPU has no control over the camera's gain/exposure
> > time.  It may be possible to put the camera into a "manual" mode, where
> > the CPU can control gain and other parameters, but I do not know how to do
> > this.
> >
> > The best person to ask is Jonathan Corbet, who wrote the camera's driver.
> > However, the camera's interface has proven difficult to work with and
> > poorly documented, so many advanced functions have not been implemented in
> > the driver.  On the XO-1.5, even basic camera functionality is still not
> > working correctly.
> >
> >>> - gather the raw images, not the JPG compressed ones.
> >
> > I did manage to do this on the XO-1.  You can try the instructions from:
> > http://lists.laptop.org/pipermail/devel/2008-February/011029.html
> >
> > This code also controls the "integration time" by acquiring many images
> > and averaging them.
> >
> > --Ben
>
>
> --- copy & paste 2 ---
>
> > From: Brian Jordan <brian at laptop.org>
> > Subject: Re: Panorama activity
> > Date: 12 October 2008 06:39:45 GMT+01:00
> >
> > On Sat, Oct 11, 2008 at 10:26 PM, Nirav Patel <olpc at spongezone.net> wrote:
> >> My roomate and I wrote an auto-stitching Panorama Activity during the
> >> Yahoo Hack Day at CMU yesterday (ended up winning the Hack for Good
> >> award).  I'll be posting it in the wiki at some point today.  It needs
> >> a whole lot of polishing, since it was written in 24 hours.
> >>
> >> I ran into the same problem that Ben did with autowhitebalance and
> >> autoexposure.  I looked through the ov7670 driver, and it seems
> >> changing V4L2_CID_BRIGHTNESS should flip the auto exposure control
> >> (AEC) bit in one of the registers.  I added support for changing
> >> brightness to the camera module in Pygame, but either disabling AEC
> >> doesn't work, or it just makes auto gain control and auto white
> >> balance work even harder to change the image.  Other than that, the
> >> stitching seems to work ok.  I'm going to pyramidize it at some point
> >> to make it faster, and do something to improve the accuracy.  The
> >> slowness of stitching doesn't effect the user experience much though,
> >> because it only stitches after the user is done taking the pictures.
> >>
> >
> > So cool -- can't wait to try.
> >
> >> The Activity we wrote uses the Flickr API for an upload to Flickr
> >> button.  I feel that this is the most important part.  There is
> >> support for saving the stitched images as Journal entries, but it
> >> would be wonderful if a kid anywhere in the world could see panoramas
> >> taken by other kids elsewhere.  Flickr is far from ideal for this.
> >> Beyond not really being designed for viewing panoramas, it is
> >> currently set up to just upload every picture to my personal Flickr
> >> account.  My API key, secret key, and an authentication token are
> >> prerecorded in the activity, so anyone could potentially use those
> >> values to edit existing photos and upload whatever to my Flickr
> >> account:  http://flickr.com/photos/nrpatel/
> >>
> >
> > Awesome! :-D
> >
> > Maybe one could set up a one-way upload script for this on dev (or
> > some appropriate
> > community-developed-web-services-server-of-the-future)? This script,
> > then, could handle the uploading via flickr API securely.
> >
> > Regards
> > Brian
> >
> >> It seems Gigapan doesn't have an upload API.  gigapan.org works in
> >> Browse on my os767 XO, but panning around an image is pretty slow.
> >> Anyone have ideas on this?  A better way to Flickr, ideas for
> >> designing a new site, getting Gigapan to add an upload API, etc?
> >>
> >> The other issue we ran into is integrating OLPCGames with pyGTK stuff.
> >> We used OLPCGames to take advantage of capturing the images as SDL
> >> surfaces, but we also wanted pyGTK to pop up a Dialog box when the
> >> user hits Save, asking for a Title, Tags, and a Description of the
> >> panorama.  We hacked together something that does pop up the box and
> >> saves correctly, but fails to ever destroy the box.  It then just sits
> >> with the box open, preventing the user from using or exiting the
> >> Activity.  Is it possible to use pyGTK beyond the toolbox while still
> >> using OLPCGames?
> >>
> >> Nirav
> >>
> >> On Fri, Sep 5, 2008 at 6:41 PM, Jeff Keller <jeff.keller at gmail.com> wrote:
> >>> Yeah -- I sent my loaner unit off to Burning Man, but I should get it
> >>> back soon, and I'd be delighted to talk about stitchers.  Randy
> >>> Sargent and I wrote our own for GigaPan last summer because nothing
> >>> else was up to the task.  It relies on a model of the GigaPan device's
> >>> behavior to do rough placement, but it can auto-stitch 1000+ images
> >>> with < 10 pixels rms displacement error, and it should be open-sourced
> >>> one of these days.  Of course, it uses much more storage, RAM, and CPU
> >>> than an XO has, but nothing inappropriate to what it does, and there
> >>> are some nice improvements in the works.  Oh, and my office is down
> >>> the block from OLPC's.
> >>> --Jeff
> >>>
> >>> On Fri, Sep 5, 2008 at 12:38 PM, Samuel Klein <sj at laptop.org> wrote:
> >>>> Speaking of which, Jeff Keller has been trying to get OLPC folks to
> >>>> learn more about using his gigapan group's cameras (and perhaps to
> >>>> borrow one to bring them into a country for weeks) for a while.  Jeff,
> >>>> Ben Schwartz and Nirav are really interested in large-scale image
> >>>> splicing...
> >>>>
> >>>> SJ
> >>>> ---
> >>>> 617 529 4266
> >>>>
> >>>>
> >>>> On Fri, Sep 5, 2008 at 2:08 AM, Brian Jordan <brian at laptop.org> wrote:
> >>>>> *bump*
> >>>>>
> >>>>> http://wiki.laptop.org/go/Panorama_camera_activity
> >>>>>
> >>>>> (code? Nirav is interested in doing something similar!)
> >>>>>
> >>>>> Brian
> >>>>>
> >>>>>> On Wed, Jun 20, 2007 at 11:56 PM, Benjamin M. Schwartz <bmschwar at fas.harvard.edu> wrote:
> >>>>>> -----BEGIN PGP SIGNED MESSAGE-----
> >>>>>> Hash: SHA1
> >>>>>>
> >>>>>> The XO happens to be perfect for shooting stitched panoramic photographs, due to
> >>>>>> the swivel design.  I tested it out in the OLPCHQ lobby. Then, I wrote a simple
> >>>>>> panorama stitcher in 50 lines of Python.  It runs in 3.4 seconds on my Core Duo,
> >>>>>> producing this output:
> >>>>>>
> >>>>>> http://people.fas.harvard.edu/~bmschwar/lobby_ugly.jpg
> >>>>>>
> >>>>>> The results aren't too bad.  I also tried stitching this scene with Hugin, the
> >>>>>> most powerful panorama stitcher I know of.  Hugin required significant user
> >>>>>> intervention and half an hour of computing time, producing this output:
> >>>>>>
> >>>>>> http://people.fas.harvard.edu/~bmschwar/lobby_pretty.jpg
> >>>>>>
> >>>>>> This scene is unusually difficult because of the huge indoor-outdoor contrast.
> >>>>>> Given this positive result, I would like to work on a panorama-making activity,
> >>>>>> possibly inside Capture.  I know that at age 10, I loved making panoramas out of
> >>>>>> photographs.  Panoramas provide an immersive way for children to communicate
> >>>>>> their environments to each other and to the world.
> >>>>>>
> >>>>>> - --Ben Schwartz
> >>>>>> -----BEGIN PGP SIGNATURE-----
> >>>>>> Version: GnuPG v1.4.7 (GNU/Linux)
> >>>>>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> >>>>>>
> >>>>>> iD8DBQFGeU4yUJT6e6HFtqQRAv4rAJ9F5wTDfzz9piYzzwGskVVmaqZTiQCgjFru
> >>>>>> QsRergUtY1iCZS6hIXCHjSM=
> >>>>>> =v5GB
> >>>>>> -----END PGP SIGNATURE-----
> >>>>>> _______________________________________________
> >>>>>> Devel mailing list
> >>>>>> Devel at lists.laptop.org
> >>>>>> http://lists.laptop.org/listinfo/devel
> >>>>>>
> >>>>>
> >>>>
> >>>
> >>
> >
> _______________________________________________
> Devel mailing list
> Devel at lists.laptop.org
> http://lists.laptop.org/listinfo/devel



--
Anish Mangal
anish at sugarlabs.org



More information about the Devel mailing list