-
Notifications
You must be signed in to change notification settings - Fork 1k
Multiple cameras with Vuforia using SwitchableCamera #203
Description
Initializing Vuforia twice with different cameras always throws a no-camera-access error. But after looking through the sdk code (specifically VuforiaLocalizerImpl) I found that SwitchableCamera was a thing. It seems to suggest that running Vuforia on two separate cameras is possible by switching between them. What is the correct way to do this?
Setup: Control Hub with 2 web cameras connected.
Both work when run individually.
Here is how I am using SwitchableCamera
CameraName webcam1 = hardwareMap.get(WebcamName.class, "webcam 1");
CameraName webcam2 = hardwareMap.get(WebcamName.class, "webcam 2");
SwitchableCameraName switchableCameraName = SwitchableCameraNameImpl.forSwitchable(webcam1, webcam2);
VuforiaLocalizer.Parameters parameters = new VuforiaLocalizer.Parameters();
parameters.cameraName = switchableCameraName;
// ...and then the rest of vuforia initializationI believe that Impl classes are not really meant to be used directly, but I could not find another way to create SwitchableCameraName.
When running this in an OpMode, I do not get any readings (trackables are not visible), and calling setActiveCameraon (SwitchableCamera) vuforiaLocalizer.getCamera() throws errors.
I will post the models of the webcams, the code I am using, and the specific error messages in a day or two once I go to the workshop again.