mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-23 01:21:40 +00:00
Add more video mode checking to camera streamer
seems to resolve spam-y errors saying `CvException [org.opencv.core.CvException: cv::Exception: OpenCV(3.4.7) /__w/1/s/opencv/modules/core/src/matrix_wrap.cpp:1658: error: (-215:Assertion failed) !fixedSize() in function 'release'`
This commit is contained in:
@@ -86,6 +86,18 @@ public class CameraStreamer {
|
||||
// Size newSize = new Size(newWidth, newHeight);
|
||||
Imgproc.resize(streamBuffer, streamBuffer, this.size);
|
||||
}
|
||||
|
||||
var sourceVideoMode = cvSource.getVideoMode();
|
||||
var imageSize = streamBuffer.size();
|
||||
if(sourceVideoMode.width != (int) imageSize.width || sourceVideoMode.height != (int) imageSize.height) {
|
||||
synchronized (streamBufferLock) {
|
||||
cvSource.setVideoMode(new VideoMode(sourceVideoMode.pixelFormat,
|
||||
(int)imageSize.width,
|
||||
(int) imageSize.height,
|
||||
sourceVideoMode.fps));
|
||||
}
|
||||
}
|
||||
|
||||
cvSource.putFrame(streamBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user