mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-22 01:11:40 +00:00
Add more descriptive exception to USBCameraCapture
This commit is contained in:
@@ -13,6 +13,7 @@ import org.opencv.core.Size;
|
||||
import org.opencv.imgcodecs.Imgcodecs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class USBCameraCapture implements CameraCapture {
|
||||
@@ -30,6 +31,12 @@ public class USBCameraCapture implements CameraCapture {
|
||||
cvSink = CameraServer.getInstance().getVideo(baseCamera);
|
||||
properties = new USBCaptureProperties(baseCamera, config);
|
||||
|
||||
var videoModes = properties.getVideoModes();
|
||||
if(videoModes.size() < 1) {
|
||||
throw new VideoException("0 video modes are valid! Full list provided by camera: \n\n"
|
||||
+ Arrays.toString(baseCamera.enumerateVideoModes()));
|
||||
}
|
||||
|
||||
int videoMode = properties.videoModes.size() - 1 <= config.videomode ? config.videomode : 0;
|
||||
setVideoMode(videoMode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user