Did my due diligence, apologies if I am missing an existing question like this.
In Processing, I’m used to the printArray(capture.list()); function which gives me all available resolutions and framerates of the webcam. Is there any way to get the available resolutions of the webcam? I’d like to offer the user the ability to change the resolution at runtime. To a lesser degree, I’m also interested in this for framerate.
vidgrabber.listDevices() just gives me the singular device, #0, while running in Processing gives me 8+ devices.
But I just discovered something a few days ago: if I do not first call webcam.setup(), then the formats and resolutions are empty. Which I find a bit odd, because I wanted to query the resolutions to decide which one to use (like in Processing). As it is, it seems like I should setup the webcam with a resolution of 640x480, get the list of formats and frame rates, close the webcam, and start it again with one of the resolutions I got previously.
I don’t know why it can happen that you don’t even receive the list of devices. Which OS? What kind of camera? Have you tried on a different USB port or rebooting?
Edit: re reading your question, maybe you do only have one device, in which case, you can try what I suggested: first setup the camera and then get the resolutions.
@hamoid, @prismspecs, can I you tell me what is your configuration ?
With OF 0.10.0 + qtcreator + windows 7, the list of avalaible resolution remains empty, even after grabber.setup().
Thanks
Perhaps I should open an issue for that. Can I ask you what do you think @theo ?
This is not really an issue because… it appear that it is just not implemented
I just read some stuff about getting the resolution list with directshow, and I fear it is a little bit overwhelming for me to implement this feature. If someone can provide the directshow code to get the list of avalaible resolutions and how to bring it in the OF code, I can help to update the ofDirectShowGrabber class and take care of the PR work.
For example I’ve found this: https://stackoverflow.com/questions/4359775/windows-how-to-get-cameras-supported-resolutions/4360002#4360002
yes this is simply not implemented in windows yet, if you want to open an issue that would help tracking it in case someone wants to implement it at some point