@Override protected void setup() { // open camera and set resolution cam = new VideoCapture(); cam.open(camId); cam.set(Videoio.CV_CAP_PROP_FRAME_WIDTH, camWidth); cam.set(Videoio.CV_CAP_PROP_FRAME_HEIGHT, camHeight); // check if camera is open if (!cam.isOpened()) { throw new IllegalStateException("Couldn't open cam: " + camId); } }
@Override protected void shutdown() { System.out.println("Shutdown cam " + camId); cam.release(); while (cam.isOpened()) {} }