Skip to content

Commit

Permalink
Remove frame size check on each frame acquisition
Browse files Browse the repository at this point in the history
This doesn't seem needed for now. Should be implemented in the future if need be.
  • Loading branch information
daharoni committed Feb 21, 2020
1 parent c6bfe47 commit 11f4eb9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 10 additions & 9 deletions source/videostreamocv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,17 @@ void VideoStreamOCV::startStream()
}
}
else {
// Let's make sure the frame acquired has the correct size. An openCV error seems to occur on cam reconnect due to a mismatch in size.
if (frame.cols != m_expectedWidth || frame.rows != m_expectedHeight) {
sendMessage("Warning: " + m_deviceName + " acquired frame has wrong size. [" + QString::number(frame.cols) + ", " + QString::number(frame.rows) + "]");
qDebug() << "Wrong frame size for device" << m_cameraID;

// This likely means the correct video stream crashed and openCV defaulted to a different video stream. So lets disconnect and try to reconnect to the correct one
cam->release();

}
else {
// Let's make sure the frame acquired has the correct size. An openCV error seems to occur on cam reconnect due to a mismatch in size.
// if (frame.cols != m_expectedWidth || frame.rows != m_expectedHeight) {
// sendMessage("Warning: " + m_deviceName + " acquired frame has wrong size. [" + QString::number(frame.cols) + ", " + QString::number(frame.rows) + "]");
// qDebug() << "Wrong frame size for device" << m_cameraID;

// // This likely means the correct video stream crashed and openCV defaulted to a different video stream. So lets disconnect and try to reconnect to the correct one
// cam->release();
// }
// else {
if (true) {
if (m_isColor) {
frame.copyTo(frameBuffer[idx%frameBufferSize]);
}
Expand Down
2 changes: 1 addition & 1 deletion userConfigs/UserConfigExample_V4_BNO_Plus_BehavCam.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"deviceType": "Miniscope_V4_BNO",
"imageRegistration": "Off",
"streamHeadOrientation": true,
"deviceID": 2,
"deviceID": 1,
"showSaturation": true,
"compressionOptions": ["MJPG","MJ2C","XVID","FFV1"],
"compression": "FFV1",
Expand Down

0 comments on commit 11f4eb9

Please sign in to comment.