How to Count Cameras in Opencv 2.3

OpenCV counting cameras

Yes, there is method can count cameras.

you have to use directshow or directshow.net.

IEnumMoniker.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms692852%28v=vs.85%29.aspx

C++ OpenCV 2.4.11: List all cameras

There is still no any functionality related to camera count in OpenCV at the current moment (3.0.0 version) - see corresponding ticket.

Proper camera handling seems like OpenCV internal problem (for example, described here or here). Usually it appears in capture code after physically disabling camera while it is still opened in OpenCV (when we try to read destroyed file descriptor).

Generally you can even implement your own handler for access violations (please look into this thread), but it's really dirty trick.

Uniquely Identifying OpenCV Cameras

Not really an answer, but then I think there isn't really one.

What I've done for production applications is to do the video handling completely outside of OpenCV and then convert the frames to OpenCV images and do further processing.

On Windows you could use DirectShow, and I've used camera-specific APIs as well. Not in any way portable or convenient, but it has the benefit of working. On the plus side, you usually get access to the full set of camera settings and features, rather than just the few properties OpenCV defines.

RE: Can OpenCV, Python3 Modules Handle SPI Devices as Cameras?

OpenCV is not designed to directly capture from SPI, therefore your code will not work easily.
Nevertheless, if you look into capturing a video, try capturing the images and with pylepton and then writing it to a videofile with openCV

import cv2
from pylepton import Lepton

running = True
out = cv2.VideoWriter('project.avi',cv2.VideoWriter_fourcc(*'DIVX'), 15, size)
with Lepton() as l:
while running
a,_ = l.capture()
out.write(a)

key = cv2.waitKey(1) & 0xFF
if key == ord("q"):
break
out.release()


Related Topics



Leave a reply



Submit