How to capture video from an external camera using opencv on ubuntu - c++

I am a beginner to ubuntu. I am trying to drive a external camera on ubuntu 15.04. I want to know how to combine opencv library with camera driver. So I can capture video use sentences like
VideoCapture cap;
cap.open(0);//0,1,2...
Does anyone have some idea? Looking forward to your reply!

It depends on the camera you use, some cameras you need do nothing, and some cameras give API,you can use the API to get the video then use opencv to do something.

Related

Can OpenCV capture image from Microsoft Surface Pro camera?

Basically, I have a prototype ready with OpenCV that captures images from connected webcams. We need to ship it to customers and they include Surface Pro users, which has an integrated rear camera.
I am not sure whether it would work on that device or not i.e. whether my code would detect the integrated Surface Pro camera or not. We currently do not have access to such a machine.
So, is there a way validate this? I can think of two options:
Is there any emulator available for Surface Pro camera?
Does OpenCV provide a list of cameras which it supports?
Would really appreciate any form of assistance here!
OpenCV works via the OS camera drivers. If the Surface Pro camera appears as a normal camera to Windows OpenCV should see it as just another camera.
For record's sake - This Stack Overflow answer gives the code for iterating available devices.
And personally I can verify that OpenCV works with the Surface Pro cameras (front and rear). We are using the EMGU port of it.

Geting videostream from Baumer GigE Cameras and use it in OpenCV

I'm trying to get a videostream from gigE Baumer txg12 camera, to use it in my openCV app. But I don't know how to achieve it.
Does anybody have experience with using Baumer SDK with openCV?
How can I get my video-stream?

OpenCV: what makes a device recognisable by OpenCV?

I would like to know how OpenCV does to find devices that it can read from?
Can OpenCV only read from usb devices?
I have a video acquisition card (BlackMagic Intensity) and I until now used the blackMagic's SDK to retrieve the stream coming from the input port on the card, and converted it to a cv::Mat that I then use in my code.
But can't I not develop some kind of C++ plugin for OpenCV so that I can use VideoCapture to access my blackMagic stream? wouldn't it be a cleaner way of doing this?
Hope you can help

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.

Firewire camera with OpenCv 2.4. not working

I am using OpenCV 2.4 with C++ for image processing and video streaming . I would like to know how we can use fire-wire camera like pixilink to capture frames? I tried the VideoCapture class but it seems to work with only usb cameras unlike firewire one. If some one has done same thing with firewire camera then kindly give some guidance how to do that?
You can capture images using firewire SDK or you can also libdc1394 API. I found libdc1394 to more reliable and easy to use and there are couple of examples available to get start.