i am looking for a way to check if a webcam is properly setup.
I am reading the result of the boolean returned by ofVideoGrabber.setup() or testing with ofVideoGrabber.isInitialized() but it always returns true no matter is the camera exists or not.
I am using a macbook pro with integrated camera on oF0.9.8. I have only one device (the integrated one).
testing is always returning true no matter which device i initialize. With :
auto devs = cam.listDevices();
for(auto & d : devs) {
std::cout << d.id << ": " << d.deviceName << std::endl;
}
// output:
// 0: FJ Camera: FJ Camera
// 1: Microsoft® LifeCam HD-3000: Mi
That only answers your question in part. This way you can avoid trying with cameras that don’t exist, but it would not tell you if it really worked. Odd that you get true for .isInitialized()…
i tried it again. It seems even if specifying a device, the app will use the first available device. For instance on my macbook the is only the integrated cam.
Whether i choose device 0, 1, 2… etc
cam.setDeviceID(2);
the integrated cam lights up and i get its image displayed