Issue 1:
System information (version)

OpenCV => 3.4 and 4.3

Operating System / Platform => Ubuntu 18.04

Compiler => GCC 7.5.0

Detailed description

I'm having some trouble since I changed from OpenCV 3.2 (repo version) to 4.x (compiled from source) in my C++ project (also happens in 3.4). I've replicated this behaviour in a small example that just opens a webcam and records for 5 seconds.

With 3.2 and 3.3 I am able to set the webcam framerate to 30 at full hd, but the same code with 3.4 or 4.3 just ignores the camera.set(cv::CAP_PROP_FPS,30) and sets it to 5 instead. If I use 720p, the fps is set to 10.

I've done more tests with other two computers and different cameras. One yields the same result, but a Macbook Pro running the same distribution OpenCV 4.3 seems to work. The two computers where I get the fps problem are desktops with usb webcams.

Issue submission checklist

I report the issue, it's not a question

I checked the problem with documentation, FAQ, open issues,

answers.opencv.org, Stack Overflow, etc and have not found solution

I updated to latest OpenCV version and the issue is still there

There is reproducer code and related data files: videos, images, onnx, etc

#include "opencv2/opencv.hpp"
#include "iostream"
#include "thread"
#include <unistd.h>

using namespace cv;

VideoCapture camera(0);
bool stop = false;
int fc = 0;

void saveFrames()
{
while(!stop)
{
Mat frame;
camera >> frame;
cv::imwrite("/tmp/frames/frame" + std::to_string(fc) + ".jpg", frame);
fc++;
}
}

int main()
{
if(!camera.isOpened())
return -1;

camera.set(cv::CAP_PROP_FRAME_WIDTH,1920);
camera.set(cv::CAP_PROP_FRAME_HEIGHT,1080);
camera.set(cv::CAP_PROP_FPS,30);

double fps = camera.get(cv::CAP_PROP_FPS);
std::cout << "FPS setting: " << fps << std::endl; // 5 with OCV4, 30 with OCV3.2

std::thread tr(saveFrames);
int waitSeconds = 5;
usleep(waitSeconds * 1e6);
stop = true;
tr.join();

std::cout << "Written " << fc << " frames of " << fps * waitSeconds << std::endl;
return 0;
}

Issue 2:
System information (version)

OpenCV => 3.4.4

Operating System / Platform => Ubuntu 16.04 64 Bit

Compiler => Python Version OpenCV 3.4.4

caffe version SSD detector supports multiple "min_size" and "max_size" param

but OpenCV gives a error:

[libprotobuf ERROR /io/opencv/3rdparty/protobuf/src/google/protobuf/text_format.cc:288] Error parsing text-format opencv_caffe.NetParameter: 913:13: Non-repeated field "min_size" is specified multiple times.

Traceback (most recent call last):

File "face_det.py", line 60, in

net = cv.dnn.readNetFromCaffe(prototxt_file, caffeModel=caffemodel_file)

cv2.error: OpenCV(3.4.4) /io/opencv/modules/dnn/src/caffe/caffe_io.cpp:1151: error: (-2:Unspecified error) FAILED: ReadProtoFromTextFile(param_file, param). Failed to parse NetParameter file: yufacedetectnet-open-v1.prototxt in function 'ReadNetParamsFromTextFileOrDie'

the PriorBoxParameter which Caffe defined as below:

// Message that store parameters used by PriorBoxLayer

message PriorBoxParameter {

// Encode/decode type.

enum CodeType {

CORNER = 1;

CENTER_SIZE = 2;

CORNER_SIZE = 3;

}

// Minimum box size (in pixels). Required!

repeated float min_size = 1;

// Maximum box size (in pixels). Required!

repeated float max_size = 2;

// Various of aspect ratios. Duplicate ratios will be ignored.

// If none is provided, we use default ratio 1.

repeated float aspect_ratio = 3;

// If true, will flip each aspect ratio.

// For example, if there is aspect ratio "r",

// we will generate aspect ratio "1.0/r" as well.

optional bool flip = 4 [default = true];

// If true, will clip the prior so that it is within [0, 1]

optional bool clip = 5 [default = false];

// Variance for adjusting the prior bboxes.

repeated float variance = 6;

// By default, we calculate img_height, img_width, step_x, step_y based on

// bottom[0] (feat) and bottom[1] (img). Unless these values are explicitely

// provided.

// Explicitly provide the img_size.

optional uint32 img_size = 7;

// Either img_size or img_h/img_w should be specified; not both.

optional uint32 img_h = 8;

optional uint32 img_w = 9;

// Explicitly provide the step size.

optional float step = 10;

// Either step or step_h/step_w should be specified; not both.

optional float step_h = 11;

optional float step_w = 12;

// Offset to the top left corner of each cell.

optional float offset = 13 [default = 0.5];

}