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
When Is C++ Covariance the Best Solution
Why Doesn't the C++11 'Auto' Keyword Work for Static Members
How Could Comma Separated Initialization Such as in Eigen Be Possibly Implemented in C++
Lambdas and Capture by Reference Local Variables:Accessing After the Scope
Are Variadic MACros Nonstandard
Why Does Sqrt() Work Fine on an Int Variable If It Is Not Defined for an Int
Why Can't I Replace Std::Map with Std::Unordered_Map
How to Do Static_Assert with MACros
Why "Cout" Works Weird for "Unsigned Char"
How Does a Sentinel Node Offer Benefits Over Null
Open File with Fopen, Given Absolute Path on Windows
Qt Moc with Implementations Inside of Header Files
What Is Aggregate Initialization
Copy Constructor VS. Return Value Optimization
Uniform Initialization Fails to Copy When Object Has No Data Members
Get a Reverse Iterator from a Forward Iterator Without Knowing the Value Type