Linksys Wireless Camera

From CoMo Robotics
Jump to: navigation, search

Camera Details

Linksys.jpg

  • model: Linksys WVC54GCA
  • access: comopc17.vub.ac.be
  • ip: 134.184.24.66
  • http-stream: http://comopc17.vub.ac.be/img/video.mjpeg
  • rtsp stream: rtsp://comopc17.vub.ac.be:554/img/video.sav (stream that can be opened by vlc,ffmpeg, mencoder, etc using rtsp over tcp protocol)
  • use username:password@comopc17... to immediately log in.

Local Access

The camera can only be accessed through the network (no usb/firewire). In order to process images from the camera (e.g. using opencv) it can be necessary to access the camera as a local device. Here is a how-to for Ubuntu. Adapted from here. Tested and confirmed working under 9.10 and 10.04. (note: writing a streaming capture extension to your program would be more efficient.)

  • Create a local v4l2 loopback device. This can be done using AVLD. The program is out of date however and will no longer compile using newer kernels. Use this patched version instead (link requires you to be logged in to the como main site).
    • $tar -xvjf avld_0.1.4.tar.bz2
    • $make && sudo make install
  • start the loopback device: $sudo modprobe avld width=640 height=480 fps=25
  • use mencoder to direct camera stream to loopback device: $sudo mencoder -rtsp-stream-over-tcp rtsp://username:password@comopc17.vub.ac.be:554/img/video.sav -nosound -ovc raw -vf scale -of rawvideo -o /dev/video0 (...or video1 if local camera is already present)
  • While mencoder is running, the camera stream can be accessed as the local device /dev/video0

Using OpenCV

After completing the above procedure, the camera can be used as any other camera with openCV. This test program displays the camera input:

#include "highgui.h"
#include "cv.h"
#include "cvaux.h"
#include <ml.h>

int main(int argc,char *argv[])
{
  cvNamedWindow( "Current Frame");
  IplImage* pCurrentFrame = NULL;
  CvSize frame_size;
  CvCapture* capture = cvCaptureFromCAM ( 0 ); //the dummy device make the job :)
  char c;
  while ( 1 )
    {
      //Request frame from Camera
      pCurrentFrame = cvQueryFrame ( capture );
      //video input file finished		
      if( !pCurrentFrame ) break;
      cvShowImage( "Current Frame", pCurrentFrame );
      c = cvWaitKey(10);
      if ( c == 27 ) break;
    }
  cvReleaseImage ( &pCurrentFrame );
  cvDestroyAllWindows ();
  return 0;
}
  • save this program in testcv.cpp
  • to compile run $g++ testcv.cpp -I/usr/include/opencv/ -L/usr/lib/ -lcv -lcvaux -lhighgui -o testcv
  • ./testcv wil now open a window showing the camera stream