MCPcopy Create free account
hub / github.com/Smorodov/Multitarget-tracker / OpenCapture

Method OpenCapture

example/VideoExample.cpp:675–705  ·  view source on GitHub ↗

\brief VideoExample::OpenCapture \param capture \return

Source from the content-addressed store, hash-verified

673/// \return
674///
675bool VideoExample::OpenCapture(cv::VideoCapture& capture)
676{
677 if (m_inFile.size() == 1)
678 {
679#ifdef _WIN32
680 capture.open(atoi(m_inFile.c_str()), cv::CAP_DSHOW);
681#else
682 capture.open(atoi(m_inFile.c_str()));
683#endif
684 //if (capture.isOpened())
685 // capture.set(cv::CAP_PROP_SETTINGS, 1);
686 }
687 else
688 capture.open(m_inFile);
689
690 if (capture.isOpened())
691 {
692 capture.set(cv::CAP_PROP_POS_FRAMES, m_startFrame);
693
694 m_fps = std::max(1.f, (float)capture.get(cv::CAP_PROP_FPS));
695
696 m_frameSize.width = cvRound(capture.get(cv::CAP_PROP_FRAME_WIDTH));
697 m_frameSize.height = cvRound(capture.get(cv::CAP_PROP_FRAME_HEIGHT));
698 m_framesCount = cvRound(capture.get(cv::CAP_PROP_FRAME_COUNT));
699
700 std::cout << "Video " << m_inFile << " was started from " << m_startFrame << " frame with " << m_fps << " fps, frame size " << m_frameSize << " and length " << m_framesCount << std::endl;
701
702 return true;
703 }
704 return false;
705}
706
707///
708/// \brief VideoExample::WriteFrame

Callers 1

CaptureAndDetectMethod · 0.80

Calls 4

openMethod · 0.80
sizeMethod · 0.45
setMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected