Capture live video from a DSLR in C++/OpenCV - c++

My C++/OpenCV app runs well when I use a USB webcam to capture live video stream.
However, when I connect a Canon 5Dii with live video it doesn't find the camera.
The Canon utility captures the video well.
Should I use the VideoCapture cap(1)?

You should use the official Canon Digital Camera SDK to grab frames from 5D II. There are some sample apps for connecting to the camera (as a source device) from your PC and then receiving camera events/images. Keep in mind that you need to sign up and be approved by Canon to use the SDK.

Related

Problems on OpenCV with IP Camera

Recently I am working on OpenCV to complete a design, I now have got an IP camera and just by typing the IP address of the camera and the port in my browser, like 192.168.1.1:8080, I can watch the video.
I have installed VS2010 and correctly complete the setting. I now can deal with pictures in my computer and capture videos of the camera on my computer. But when I tried to capture videos from IP camera by
VideoCapture cap;
cap.open("http://192.168.137.235:8082/index.html")
there is an error:
Error opening file (../../modules/highgui/src/cap_ffmpeg_impl.hpp:545)
so how can I solve the problem. Can anyone tell me specifically how to solve this problem?
I've tried to capture video directly from my IP camera to OpenCV-based application directly via RTSP as it was advised previously. It works, but ffmpeg decoder works very unstable with RTSP stream from some cameras.
I found the next solution.
Some people like to perform live streaming of their PC screen to youtube. The standard tool for it is a XSplit Broadcaster.
This tool has a side-effect. It's able to create a virtual usb-webcam via RTSP-compatible IP camera.
OpenCV captures video from usb-webcams perfectly.
And basic license of XSplit Broadcaster is absolutely free.
Unfortunately this solution has a limitation. With no dependence on real resolution of your IP camera, resolution of virtual webcam will be 640*480
The page "index.html" could be only the main page of your video camera, the page where a human uses to navigate the camera and to watch the live.
The ip cameras are very different each of the others. If your ip camera is "onvif" it should have a rtsp socket. For example I can watch my ip camera using this path:
rtsp://address:554/onvif1
If you camera implements the mjpeg stream you shoult use the right path, for example
http://192.168.137.235:8082/live.html
To know wich is the righ way to connect to your camera, it is necessary to know wich is your camera.

Use openCV to photography

Many webcams today can take static pictures in high resolution. e.g. Logitech C920 should be able to make 16Mpx photography, while in live video mode it can produce frames only in Full HD. Is it possible to use OpenCV to get this 16Mpx photo? All examples I found only using VideoCapture or cvCaptureFromCAM which can only access the frames of live video.

Capturing video from SMI Grabber Device using Opencv C++

I am trying to capture a video from an SMI grabber device using opencv c++. The line VideoCapture cap(0) obtains video from web cam. How do I get the feed from the device that I have connected.
From openCV docs
VideoCapture
public VideoCapture(int device)
Parameters:
device - id of the opened video capturing device (i.e. a camera index). If there is a single camera connected, just pass 0.
As per this answer, it's not possible at the moment to enumerate devices via OpenCV however you could try passing 1 and see if the SMI device is found there.

Can OPENCV access a analog camera using a video capture device

I have been trying to access my analog camera via a EasyCap video capture device. Any code I try only picks the usb webcam or internal webcam. I guess that since video capture device is a video controller, opencv doesnt recognize it as a imaging device.
Can anyone conform if you cannot access analog cameras with opencv via a video capture device.
If so, then what other method can be used.
i struggled with the same problem (in my case within python instead of C++, although I am certain it will be the same root cause) and hope it helps!
the original thread + ANSWER
also relevant XKCD
Even for digital devices, OpenCV isn't good at reading them, it is good at processing them. The library has supply for generic webcams, of course; however it does not supply most of the commercial or industrial cameras.
In short, to decode, you should try using "video for linux" or "video for windows" libraries; or the device SDK itself. Since you are using a video2usb converter, you shouldn't have any problem accessing the analog camera through these software.

Is decoder automaticly added between two filter?

I have created a c++ dll where it shows camera live streaming at panel handle with DirectShow API. My Camera is Logitech c920 Webcam. My camera offers H264 codec on the 3rd output pin.
When I use graphEdit, if I connect the Logitech Webcam 3rd output Pin to Video Mixing Render 9 1st input pin, it automaticly adds the DTV-DVD microsoft decoder between the connection like this :
Logitech HD Pro Webcam C920 [Capturer] => [VMR Input0] Video Mixing Renderer 9
(When connected become)
Logitech HD Pro Webcam C920 [Capturer] => [video Input1] Microsoft DTV-DVD Video Decoder [video Output 1] => [VMR Input0] Video Mixing Renderer 9
The quality is very nice and I have a fast video streaming rates on the active movie window.
This is where it's getting incorrect. In my code, I have directly connected the 3rd pin of capture source to vmr7 input pin (without adding dt-dvd decoder). I have also set the video settings as 1600x896 and H264 Mediatype with IAMStreamConfig.
I readed on msdn (if i have understand correctly) that directshow will automaticly put the necessary filter between two connected pins. It's working but the video quality is terrible.It looks like theres lot pixels mixed or corrupted. I also don't have any evidence that the filter as been added. Is it because i haven't programmaticaly put the decoder between them? And if it could be, how do I add this filter?
Thanks in advance and sorry for the english.
The problem is here:
if I connect the Logitech Webcam 3rd output Pin to Video Mixing Render 9
versus
I have directly connected the 3rd pin of capture source to vmr7 input pin
VMR-9 vs. VMR-7. The former is backed by Direct3D surfaces, with frames scaled smoothly by hardware. The latter, on the opposite, uses DirectDraw surfaces with scaling unavailable since Windows Vista, and the picture quality is terrible.
Use EVR as video renderer (or VMR-9) to get best picture quality.