mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-08-26 09:22:28 -04:00
ATV Modulator: use exclusively operator>> to retrieve camera frames
This commit is contained in:
parent
09e3a0fd8e
commit
0fa8fc486a
@ -328,43 +328,37 @@ void ATVMod::pullVideo(Real& sample)
|
|||||||
getOutputMessageQueue()->push(report);
|
getOutputMessageQueue()->push(report);
|
||||||
}
|
}
|
||||||
|
|
||||||
int grabOK;
|
|
||||||
int fpsIncrement = (int) camera.m_videoFPSCount - camera.m_videoPrevFPSCount;
|
int fpsIncrement = (int) camera.m_videoFPSCount - camera.m_videoPrevFPSCount;
|
||||||
|
|
||||||
// move a number of frames according to increment
|
// move a number of frames according to increment
|
||||||
// use grab to test for EOF then retrieve to preserve last valid frame as the current original frame
|
// use grab to test for EOF then retrieve to preserve last valid frame as the current original frame
|
||||||
// TODO: handle pause (no move)
|
cv::Mat colorFrame;
|
||||||
|
|
||||||
for (int i = 0; i < fpsIncrement; i++)
|
for (int i = 0; i < fpsIncrement; i++)
|
||||||
{
|
{
|
||||||
grabOK = camera.m_camera.grab();
|
camera.m_camera >> colorFrame;
|
||||||
if (!grabOK) break;
|
if (colorFrame.empty()) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grabOK)
|
if (!colorFrame.empty()) // some frames may not come out properly
|
||||||
{
|
{
|
||||||
cv::Mat colorFrame;
|
if (m_showOverlayText) {
|
||||||
camera.m_camera.retrieve(colorFrame);
|
mixImageAndText(colorFrame);
|
||||||
|
|
||||||
if (!colorFrame.empty()) // some frames may not come out properly
|
|
||||||
{
|
|
||||||
if (m_showOverlayText) {
|
|
||||||
mixImageAndText(colorFrame);
|
|
||||||
}
|
|
||||||
|
|
||||||
cv::cvtColor(colorFrame, camera.m_videoframeOriginal, CV_BGR2GRAY);
|
|
||||||
resizeCamera();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (camera.m_videoFPSCount < camera.m_videoFPS)
|
cv::cvtColor(colorFrame, camera.m_videoframeOriginal, CV_BGR2GRAY);
|
||||||
{
|
resizeCamera();
|
||||||
camera.m_videoPrevFPSCount = (int) camera.m_videoFPSCount;
|
}
|
||||||
camera.m_videoFPSCount += camera.m_videoFPSq;
|
|
||||||
}
|
if (camera.m_videoFPSCount < camera.m_videoFPS)
|
||||||
else
|
{
|
||||||
{
|
camera.m_videoPrevFPSCount = (int) camera.m_videoFPSCount;
|
||||||
camera.m_videoPrevFPSCount = 0;
|
camera.m_videoFPSCount += camera.m_videoFPSq;
|
||||||
camera.m_videoFPSCount = camera.m_videoFPSq;
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
|
camera.m_videoPrevFPSCount = 0;
|
||||||
|
camera.m_videoFPSCount = camera.m_videoFPSq;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user