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

Merge branch '3.4' into merge-3.4

This commit is contained in:
Alexander Alekhin
2018-12-22 05:40:15 +00:00
29 changed files with 995 additions and 1879 deletions
+6 -1
View File
@@ -237,6 +237,11 @@ make & enjoy!
#include <sys/videoio.h>
#endif
// https://github.com/opencv/opencv/issues/13335
#ifndef V4L2_CID_ISO_SENSITIVITY
#define V4L2_CID_ISO_SENSITIVITY (V4L2_CID_CAMERA_CLASS_BASE+23)
#endif
/* Defaults - If your board can do better, set it here. Set for the most common type inputs. */
#define DEFAULT_V4L_WIDTH 640
#define DEFAULT_V4L_HEIGHT 480
@@ -1757,7 +1762,7 @@ bool CvCaptureCAM_V4L::icvSetFrameSize(int _width, int _height)
if (_width > 0)
width_set = _width;
if (height > 0)
if (_height > 0)
height_set = _height;
/* two subsequent calls setting WIDTH and HEIGHT will change
+37 -1
View File
@@ -11,7 +11,7 @@
namespace opencv_test { namespace {
static void test_readFrames(/*const*/ VideoCapture& capture, const int N = 100)
static void test_readFrames(/*const*/ VideoCapture& capture, const int N = 100, Mat* lastFrame = NULL)
{
Mat frame;
int64 time0 = cv::getTickCount();
@@ -26,6 +26,7 @@ static void test_readFrames(/*const*/ VideoCapture& capture, const int N = 100)
}
int64 time1 = cv::getTickCount();
printf("Processed %d frames on %.2f FPS\n", N, (N * cv::getTickFrequency()) / (time1 - time0 + 1));
if (lastFrame) *lastFrame = frame.clone();
}
TEST(DISABLED_VideoIO_Camera, basic)
@@ -69,4 +70,39 @@ TEST(DISABLED_VideoIO_Camera, dshow_avermedia_capture)
capture.release();
}
TEST(DISABLED_VideoIO_Camera, validate_V4L2_FrameSize)
{
VideoCapture capture(CAP_V4L2);
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, 30);
EXPECT_TRUE(capture.set(CAP_PROP_FRAME_WIDTH, 640));
EXPECT_TRUE(capture.set(CAP_PROP_FRAME_HEIGHT, 480));
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;
Mat frame640x480;
test_readFrames(capture, 30, &frame640x480);
EXPECT_EQ(640, frame640x480.cols);
EXPECT_EQ(480, frame640x480.rows);
EXPECT_TRUE(capture.set(CAP_PROP_FRAME_WIDTH, 1280));
EXPECT_TRUE(capture.set(CAP_PROP_FRAME_HEIGHT, 720));
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;
Mat frame1280x720;
test_readFrames(capture, 30, &frame1280x720);
EXPECT_EQ(1280, frame1280x720.cols);
EXPECT_EQ(720, frame1280x720.rows);
capture.release();
}
}} // namespace