Talk:OpenCV
Contents
Intro
Few people recently expressed interest in using OpenCV with Elphel cameras.
Let's concentrate our efforts using OpenCV wiki page and mailing list.
OpenCV with FFMPEG
I compiled both OpenCV 2.1 and current git version with FFMPEG support. FFMPEG support seems to work, but FFMPEG itself brake on the MJPEG stream.
I took the facedetect example in OpenCV-2.1.0/samples/c/facedetect.cpp and just modified one line:
// CvCapture* capture = 0; CvCapture* capture = cvCreateFileCapture("rtsp://192.168.0.9:554");
Running ./facetedect I can see network load from the camera, but few seconds later the program die with:
[rtsp @ 0xbefd80]Estimating duration from bitrate, this may be inaccurate picture size invalid (0x0) Last message repeated 1 times [rtsp @ 0xbf2480]Estimating duration from bitrate, this may be inaccurate
it's an FFMPEG error.
I tried both stable FFMPEG from Ubuntu 10.04, PPA version from MOTU Media Team and even fresh git version. They all die the same way. Passing -x & -y to ffplay does not help. Here is what I get directly from ffplay rtsp://192.168.0.9:554 :
FFplay version 0.6-4:0.6-2ubuntu2~lucid1~ppa1, Copyright (c) 2003-2010 the FFmpeg developers built on Jul 18 2010 16:06:55 with gcc 4.4.3 configuration: --extra-version='4:0.6-2ubuntu2~lucid1~ppa1' --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable- libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime- cpudetect --enable-gpl --enable-postproc --enable-x11grab --enable-libdc1394 --enable-shared --disable-static WARNING: library configuration mismatch libavutil configuration: --extra-version='4:0.6-2ubuntu1~lucid1~ppa1' --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libmp3lame --enable-gpl --enable-postproc --enable-x11grab --enable-libfaad --enable-libxvid --enable-libx264 --enable-librtmp --enable-libdc1394 --enable-shared --disable-static libavcodec configuration: --extra-version='4:0.6-2ubuntu1~lucid1~ppa1' --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libmp3lame --enable-gpl --enable-postproc --enable-x11grab --enable-libfaad --enable-libxvid --enable-libx264 --enable-librtmp --enable-libdc1394 --enable-shared --disable-static libavformat configuration: --extra-version='4:0.6-2ubuntu1~lucid1~ppa1' --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libmp3lame --enable-gpl --enable-postproc --enable-x11grab --enable-libfaad --enable-libxvid --enable-libx264 --enable-librtmp --enable-libdc1394 --enable-shared --disable-static libavdevice configuration: --extra-version='4:0.6-2ubuntu1~lucid1~ppa1' --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libmp3lame --enable-gpl --enable-postproc --enable-x11grab --enable-libfaad --enable-libxvid --enable- libx264 --enable-librtmp --enable-libdc1394 --enable-shared --disable-static libavutil 50.15. 1 / 50.15. 1 libavcodec 52.72. 2 / 52.72. 2 libavformat 52.64. 2 / 52.64. 2 libavdevice 52. 2. 0 / 52. 2. 0 libavfilter 1.19. 0 / 1.19. 0 libswscale 0.11. 0 / 0.11. 0 libpostproc 51. 2. 0 / 51. 2. 0 [rtsp @ 0x1c51a10]Estimating duration from bitrate, this may be inaccurate Input #0, rtsp, from 'rtsp://192.168.0.9:554': Duration: N/A, start: 0.038089, bitrate: N/A Stream #0.0: Video: mjpeg, 90k tbr, 90k tbn, 90k tbc [ffplay_output @ 0x1c57060]auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out' Impossible to convert between the formats supported by the filter 'src' and the filter 'auto-inserted scaler 0'
Please advise if you have any ideas... --Alexandre.Poltorak 05:57, 27 July 2010 (CDT)
OpenCV with GStreamer
Ok, I put FFMPEG aside for some time and decided to give a try with GStreamer.
So I compiled OpenCV with
cmake -D WITH_FFMPEG=OFF -D WITH_GSTREAMER=ON .
Still use the same facedetect example in C from samples/c directory and replace just one line:
I took the facedetect example in OpenCV-2.1.0/samples/c/facedetect.cpp and just modified one line:
// CvCapture* capture = 0; CvCapture* capture = cvCreateFileCapture("rtsp://192.168.0.9:554");
I get:
Trying to connect to stream restarting pipeline, going to ready ready, relinking filtering with video/x-raw-rgb, width=(int)1920 relinked, pausing state now paused
and facedetect fall-back to v4l device.
Looking in:
./modules/highgui/src/cap_gstreamer.cpp
I noticed that it only have support for "dv1394src", "v4lsrc", "v4l2src", "filesrc". We have to bring rtspsrc support now.
--Alexandre.Poltorak 14:17, 29 July 2010 (CDT)