Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion modules/videoio/src/cap_msmf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,12 @@ bool CvCapture_MSMF::configureVideoOutput(MediaType newType, cv::uint32_t outFor
{
initStream(dwVideoStreamIndex, nativeFormat);
}
return initStream(dwVideoStreamIndex, newFormat);
if (!initStream(dwVideoStreamIndex, newFormat))
{
return false;
}
outputVideoFormat = outFormat;
return true;
}

bool CvCapture_MSMF::configureOutput()
Expand Down
15 changes: 15 additions & 0 deletions modules/videoio/test/test_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,21 @@ TEST(DISABLED_videoio_camera, v4l_read_mjpg)
capture.release();
}

TEST(DISABLED_videoio_camera, msmf_read_yuyv)
{
VideoCapture capture(CAP_MSMF);
ASSERT_TRUE(capture.isOpened());
ASSERT_TRUE(capture.set(CAP_PROP_FOURCC, VideoWriter::fourcc('Y', 'U', 'Y', 'V')));
std::cout << "Camera 0 via " << capture.getBackendName() << " backend" << std::endl;
std::cout << "Frame width: " << capture.get(CAP_PROP_FRAME_WIDTH) << std::endl;
std::cout << " height: " << capture.get(CAP_PROP_FRAME_HEIGHT) << std::endl;
std::cout << "Capturing FPS: " << capture.get(CAP_PROP_FPS) << std::endl;
int fourcc = (int)capture.get(CAP_PROP_FOURCC);
std::cout << "FOURCC code: " << cv::format("0x%8x", fourcc) << std::endl;
test_readFrames(capture);
capture.release();
}

TEST(DISABLED_videoio_camera, v4l_open_mjpg)
{
VideoCapture capture;
Expand Down