Sunday, February 10, 2008

Linux frame grabber

For some of my robotics research, I have been trying to implement a vision based system using webcams. I got the webcams working with spca5xx, I'll put up a post later how I managed to get it to work with multiple cameras off the same root hub. But if you need to do video analysis and need a simple linux frame grabber, I high recommend
http://www.mjmwired.net/kernel/Documentation/video4linux/v4lgrab.c
It was relatively simple to use. The only thing I recommend is to not use the READ_VIDEO_PIXEL function, just address the pointer as an array and use indexing, its faster, and also,

leave out the call to

int get_brightness_adj(unsigned char *image, long size, int *brightness) {
long i, tot = 0;
for (i=0;i tot += image[i];
*brightness = (128 - tot/(size*3))/3;
return !((tot/(size*3)) >= 126 && (tot/(size*3)) <= 130);
}


as in the code it results in a very long lag, and I rather control the brightness on my own.

No comments: