1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

Merge pull request #19394 from MaximMilashchenko:params

add video capture parameters

* add parameters

* videoio: revert unnecessary massive changes

* videoio: support capture parameters in backends API

- add tests
- FFmpeg backend sample code
- StaticBackend API is done
- support through PluginBackend API will be added later

Co-authored-by: Milashchenko <maksim.milashchenko@intel.com>
Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
This commit is contained in:
MaximMilashchenko
2021-01-28 01:07:43 +03:00
committed by GitHub
parent 37c12db366
commit 467870415b
10 changed files with 428 additions and 30 deletions
+35
View File
@@ -87,6 +87,41 @@ TEST(DISABLED_videoio_camera, v4l_read_mjpg)
capture.release();
}
TEST(DISABLED_videoio_camera, v4l_open_mjpg)
{
VideoCapture capture;
capture.open(0, CAP_V4L2, {
CAP_PROP_FOURCC, VideoWriter::fourcc('M', 'J', 'P', 'G')
});
ASSERT_TRUE(capture.isOpened());
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_1280x720)
{
VideoCapture capture(0, CAP_V4L2, {
CAP_PROP_FOURCC, VideoWriter::fourcc('M', 'J', 'P', 'G'),
CAP_PROP_FRAME_WIDTH, 1280,
CAP_PROP_FRAME_HEIGHT, 720,
});
ASSERT_TRUE(capture.isOpened());
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();
}
//Following test if for capture device using PhysConn_Video_SerialDigital as crossbar input pin
TEST(DISABLED_videoio_camera, channel6)
{