opencv mjpg note

I'm using openCV 1.1pre1 under Windows. I have a network camera and I need to grab frames from openCV. That camera can stream a standard mpeg4 stream over RTSP or mjpeg over http. I've seen many threads talking about using ffmpeg with openCV but I cannot make it work.

How I can grab frames from an IP camera with openCV?

Thanks

Andrea

==========

   

Use ffmpeglib to connect to the stream.

These functions may be useful. But take a look in the docs

av_open_input_stream(...);
av_find_stream_info
(...);
avcodec_find_decoder
(...);
avcodec_open
(...);
avcodec_alloc_frame
(...);

You would need a little algo to get a complete frame, which is available here

http://www.dranger.com/ffmpeg/tutorial01.html

Once you get a frame you could copy the video data (for each plane if needed) into a IplImage which is an OpenCV image object.

You can create an IplImage using something like...

IplImage *p_gray_image = cvCreateImage(size, IPL_DEPTH_8U, 1);

Once you have an IplImage, you could perform all sorts of image operations available in the OpenCV lib

link | flag
       
 
I've seen in many threads that ffmpeg is already included and used inside openCV, is this right? Maybe I need to recompile openCV with ffgmpeg support? In this case how I can do this under windows? Thanks –  Grifo Apr 3 '09 at 12:36
 
I'm not aware of this. However, ffmpeg is an application where as ffmpeglib is a library. If you are new to these please look at the dranger.com tutorials. –  Indeera Apr 3 '09 at 13:19
=================
   

OpenCV can be compiled with FFMPEG support. From ./configure --help:

--with-ffmpeg     use ffmpeg libraries (see LICENSE) [automatic]

You can then use *cvCreateFileCapture_FFMPEG* to create a CvCapture with e.g. the URL of the camera's MJPG stream.

I use this to grab frames from an AXIS camera:

CvCapture *capture = 
    cvCreateFileCapture_FFMPEG
("http://axis-cam/mjpg/video.mjpg?resolution=640x480&req_fps=10&.mjpg");
link | flag
       
 
Is it possible to configure openCV with ffmpeg support under Windows? –  Grifo Jun 25 '09 at 9:37
===========
   

I just do it like this:

CvCapture *capture = cvCreateFileCapture("rtsp://camera-address");

Also make sure this dll is available at runtime else cvCreateFileCapture will return NULL

opencv_ffmpeg200d.dll

The camera needs to allow unauthenticated access too, usually set via its web interface. MJPEG format worked via rtsp but MPEG4 didn't.

hth

Si

link | flag
       
 
Are you using OpenCV 2.0? –  Grifo Mar 2 at 8:41
 
The library version says that he is using openCV 2.0 - that's the 200 part in opencv_ffmpeg200d.dll –  jamuraa Mar 17 at 20:41
===================
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

听海拉拉

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值