This blog entry was posted by peter on October 21, 2007.
It is tagged with reacTIVision, and tracking.
So far there are 2 comments. Feel free to add one.
The previous entry chronologically is A Django template tag for integrating a Flash based flv player.
I have written a V4L2 (video4Linux2) camera engine for reacTIVision under Linux. The engine was developed using a Logitech Quickcam 5000 (046d:08c5) but it should work with any V4L2 compatible camera.
You need a working V4L2 camera. In my case I used the drivers from the linux-uvc project to power a Logitech Quickcam 5000. I tested the cam with luvcview and kdetv.
The engine was written using reacTIVision-1.3 and is untested with any other version. In order to compile the engine you need to download the reacTIVision-1.3-src.zip, extract it and continue with the installation of the V4L2 camera engine below.
Download the V4L2 engine from here and extract it to the linux/ subfolder of the extracted reacTIVision package:
See the Changelog for more version information.
The V2L2 engine consists of two files:
If not already done so, copy the two files into the linux/ subfolder of the reacTIVision package.
In the header file common/cameraTool.h change the LINUX preprocessor block to contain the new header file:
1 2 3 4 5 6 7 | #ifdef LINUX #include <stdio.h> #include <stdlib.h> #include “../linux/linuxfwCamera.h” #include “../linux/v4linuxCamera.h” #include “../linux/v4linux2Camera.h” #endif |
In the file common/cameraTool.cpp change the LINUX implementation to create a v2linux2Camera:
1 2 3 4 5 6 7 8 | #ifdef LINUX
camera = new linuxfwCamera();
if( !camera->findCamera() ){
delete camera;
// check video4linux2
camera = new v4linux2Camera();
}
#endif
|
Note that this will completely deactivate the support for V4L (1) cameras. There’s currently no way of using V4L and V4L2 in parallel. Furthermore you should not have any firewire camera attached because they are searched first.
After you have applied the changes to the files go to the linux subdirectory and type make to build the executable:
1 2 | cd linux make |
The compiled reacTIVision executable is now capable of using V4L2 cameras.
By default the video device /dev/video0 is used. To change that behaviour you can set the V4L2_DEVICE environment variable to the name of the video device. E.g. to use the camera at /dev/video1:
1 | export V4L2_DEVICE=/dev/video1 |
The above example assumes that you are using bash. If you are a csh user write:
1 | setenv V4L2_DEVICE /dev/video1 |
Comments are disabled for this entry.