[KLUG Members] non-X image processing

Mike Williams members@kalamazoolinux.org
Tue, 7 May 2002 15:20:17 -0400


I recently got a USB webcam working under Linux (cheers) and am having some 
trouble automating the snapshots.  Essentially, I'm having to make my own 
webcam software.  The interface to the cam is a command-line utility, which 
is pretty basic but does work.  I have written a script that takes the 
picture, then runs convert on it to make it the right size, then shifts the 
previous snapshots "down" to make room for the new one and copies it into 
place.  Here are the current problems with the arrangement:

1.  The exposure setting is manual.  Some sort of autoexposure for the grab 
software is in progress, but it could be a long way off.  Does anybody know 
of a way to produce an "average brightness" number from a picture?  With 
that I could write a script that would zero in on the correct setting.

2.  Another possibility I'm working on is manually adjusting the settings 
based on the time of day, but I can't seem to get the date command to give 
me just time to the nearest hour.  I also want to use this to stop it from 
updating in the middle of the night when the lights are off.

3.  The script has to be launched manually, and there's no way to interact 
with it other than to ps -e and kill the sleep process.  Any way to make it 
launch through rc.d like a real service?  Also helpful would be a way to 
dump a .pid file into /var/run.

4.  I'd also like to add a timestamp to the images.  Convert is supposed to 
be able to do this, but I haven't gotten it right yet.  The man page is 
pretty cryptic, even for a man page.

All advice, ideas, or brainstorms welcome.