AltSci Concepts

Webcam Algorithm Input
by Joel R. Voss aka. Javantea
jvoss@altsci.com
jvoss@myuw.net
Sept 16, 2006

Webcam Algorithm Input Method 5 Beta Source [sig]
Webcam Algorithm Input 0.1 Source [sig]

DESCRIPTION

For many projects, using a webcam hooked up to a Linux-based PC is an excellent input method. Since many laptops also contain serial and parallel ports, a program can be written that uses a USB webcam and serial port for input and serial ports and parallel ports for outputs.

The simplest way to get webcam input is from a program that is already good at getting this input. I use transcode, but others are available. With transcode, I can import frames at 20 fps average. With a minor modification to transcode, I can import this directly to my program using a named pipe. The data is then accessible from my program. This version 0.1 is a null program that simply shows a double buffer system that can be used for any data output.

METHOD

The modified export_ppm.c opens the named pipe, writes the frame to it, then closes the pipe.
The program webc1 takes the input from the named pipe, reads the headers from it, reads the data from it, and discards it. It uses double buffering, so that diffs can be performed efficiently.

USAGE

To get the modified export_ppm2 working, do the following:

cd ~/src
tar xzf ~/programs/ppm_parse1-0.1.tgz
tar xzf ~/programs/transcode-1.0.2.tgz
cd transcode-1.0.2/
cp ../ppm_parse1/export_ppm.c export/
configure && make
sudo cp export/.libs/export_ppm.so /usr/local/lib/transcode/export_ppm2.so
sudo cp export/.libs/export_ppm.la /usr/local/lib/transcode/export_ppm2.la
Then, you can run the tc1.sh
cd ~/src/ppm_parse1/
sh tc1.sh
# Press Ctrl-C to abort transcode
killall -INT webc1
The output of webc1 can be found in data/webc2.txt as per tc1.sh. It will look similar to this:
Reopening data/webc2.ppm.
1: P6
2: #(transcode-v1.0.2)
3: 352 288 255
Reopening data/webc2.ppm.
1: P6
2: #(transcode-v1.0.2)
3: 352 288 255
1: P6
2: #(transcode-v1.0.2)
3: 352 288 255

If you are interested in developing Webcam PPM Parser, feel free to e-mail me.

Back