-
Is there any way to find the available webcams? If not how could this be implemented or worked around? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
There is currently no methods available for camera enumeration in GDMP. If you want just workaround, on Linux you can check the presence of If you would like to implement a method for that, it would be heavily platform-specific. We need to know to what extend each target platform could provide about camera device, then define the interface and data structure for them. Using PipeWire should be a good start on Linux desktop, Windows could use DirectShow or newer Media Foundation, for Android we should be able to query camera information easier with updated CameraX. That being said I have few experience about them, and have no time to implement for now, but we can still trying to get it work without exposing the method to Godot before the feature is complete. |
Beta Was this translation helpful? Give feedback.
-
GDMP uses opencv libraries, doesent it? Even though it doesent have a builtin way of finding all webcams, with it you can use try - catch statements and and just loop through camera indexes until you find one that doesen throw an error. (https://stackoverflow.com/questions/34197825/c-opencv-2-4-11-list-all-cameras). I was thinking about implementing this, myself, but honestly i have no experience with cpp and have no idea where to even get started. If you could just help me with which file i would need to edit, i could figure out the rest myself (hopefully). |
Beta Was this translation helpful? Give feedback.
-
OpenCV implementation of camera helper is located at From what I see in OpenCV docs, neither Note that currently only desktop (Linux, Windows) uses OpenCV backend for camera helper, if you implement the enumeration method for |
Beta Was this translation helpful? Give feedback.
I believe being able to enumerate available cameras would be a highly requested features, but considering how high-level OpenCV abstract the interaction with webcam devices, I doubt implementing webcam enumeration is suitable using OpenCV in terms of efficiency and reliability. My future plan is to implement different backends for different desktop platforms, while keeping CameraHelperCV as fallback. I wouldn't recommend to spend time creating PR for a backend that is considered fallback to-be.