OpenCV: Open Mobotix Camera Feed

I have a Mobotix camera. This is an IP camera. In the API, they offer us the ability to receive feed through

http: // [ user ]: [ password ] @ [ ip_adress ]: [ port ] /cgi-bin/faststream.jpg? [ options ]


I tried to open it like a regular webcam channel:

cv::VideoCapture capture("http://..."); cv::Mat frame; if (capture.isOpened()) // always false anyway. while(1) { capture.read(frame); cv::imshow("Hi there", frame); cv::waitkey(10); } 

FYI: Mobotix Developer API Documents


EDIT: now thanks to berak I just need to add & data = v.mjpg to the parameters:

 ?stream=full&fps=5.0&noaudio&data=v.mjpg 

Please note that in v.mjpg only the point [dot] mjpg is important, you can also put myfile.mjpg.

Now the problem is the feed update speed. I got a delay of 2 seconds, plus the feed is very slow. And when I change the stream parameter for MxJPG or mxg, I get a damaged image in which the bytes are not sorted properly.

EDIT: I tried to change the camera settings directly using the mobotix control center, but only the resolution affected my OpenCV program, without changing the speed with which I access images.

+6
source share
1 answer

for maximum speed use fps = 0 Its in api docs

sort of

 http://cameraip/cgi-bin/faststream.jpg?stream=full&fps=0 

see http://developer.mobotix.com/paks/help_cgi-image.html

faststream - mjpeg stream (for image capture), make sure mxpeg is off and select the smallest image that gives you sufficient resolution. I get it working using 640 by 480 (install it with a webgui camera) and then increase the image size.

Note that this is for capturing an image, not for video, and you need to determine the beginning and end of each jpeg, and then copy it from the receive buffer to memory.

vlc can handle mxpeg, but you need to either start from the command line using vlc -ffmpeg-format = mxg, or set the editing parameter ffmpeg-format = mxg in gui see https://wiki.videolan.org/MxPEG

0
source

Source: https://habr.com/ru/post/973374/


All Articles