OpenCV
Contents
Single image
You can use imgsrv to download a single image from the circbuf. MJPEG live stream is also available from imgsrv.
You can use wget to download the image to your computer or implement a small HTTP client in your software.
Live video
Using AVLD
AVLD stand for AVLD - Another Video Loopback Device. It's a very CPU and RAM consuming way to present an Elphel network camera as V4l device.
While it is the only solution with proprietary v4l compatible software products (such as skype), it's a total waste of resources for a free software app what can be adapted to receive an RTP stream.
Moreover, you can downloa from:
http://allonlinux.free.fr/Projets/AVLD/src/avld_0.1.4.tar.bz2
Then:
$ tar -jxvf avld_0.1.4.tar.bz2 $ cd avld_0.1.4 $ make && sudo make install
Right now you can mount your dummy device typing:
$sudo modprobe avld width=<camera width resolution> height=<camera height resolution> fps=<camera fps>
Finally, you need to use mencoder in order to redirect the rtsp source to the dummy device:
$ sudo mencoder rtsp://192.168.1.180 -nosound -ovc raw -vf format=bgr24 -of rawvideo -o /dev/video0
With this, you just need a simple code in order to preview the scene:
#include "highgui.h" #include "cv.h" #include "cvaux.h" #include <ml.h> int main(int argc,char *argv[]) { 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; }
Using v4lsink GStreamer plugin and v4l2loopback
This is basically an AVLD fork that now evolved into v4l2loopback and a special gstreamer sink to the loopback device.
http://code.google.com/p/v4lsink/ & http://code.google.com/p/v4l2loopback/
Using OpenCV with FFMPEG
Using OpenCV with GStreamer
Design your OpenCV code as GStreamer plugin
http://github.com/Elleo/gst-opencv
Portability
Tutorials
Tennis balls recognizing
OpenCV Tennis balls recognizing tutorial