Home > Back-end >  OpenCV calls the resolution of the camera 4:3 ratio have a black border
OpenCV calls the resolution of the camera 4:3 ratio have a black border

Time:09-25

When I call camera, 640 * 480, and there will be a black border, actual display only 640 * 360, this is a 16:9 resolution, ever met a friend or a great god to answer, how to fully display the 4:3 resolution picture thank you
reference
 # include & lt; Opencv2 \ opencv. Hpp> 
#include
Using the namespace CV;
Int main ()
{

VideoCapture cap;
Cap. Open (0);
Cap. Set (CAP_PROP_FRAME_WIDTH, 640);
Cap. Set (CAP_PROP_FRAME_HEIGHT, 480);

NamedWindow (" a ");
Mat frame;

While (cap. Grab ())
{
Cap. Retrieve (frame);
Imshow (" a ", a frame);
WaitKey (1);
}
return 0;
}

CodePudding user response:

From the top to have a friend met

CodePudding user response:

Visual camera is 16:9,

CodePudding user response:

refer to the second floor 4 teacher zhao response:
visual camera is 16:9,
in Win10 bring camera, can display the 4:3, can display the black side cover image

CodePudding user response:

Cutout processing the video frames, the top and bottom part of the black side can be removed.
In python by
Frame=frame [40, 60, 420 0-6] # in proportion to cut out pictures (16:9==& gt; 640360) (4:3==& gt; 640480)
To deal with.

CodePudding user response:

Can you tell me the solution? I also appear this kind of circumstance, I set to 1280 * 720 or 1920 * 1080 won't appear the black side of up and down, but is set to 640 * 480 will appear black side,

CodePudding user response:

The building Lord solved? Meet the same problem today is MSMF this parameter will be such, how did you solve?

CodePudding user response:

VideoCapture capture (index + CAP_DSHOW);

CodePudding user response:

Meet the same problem, but also tried to capture (index + CAP_DSHOW), and have no effect, however,
4th floor, brothers, python can only be addressed by clipping?

reference 4 floor Thomson617 response:
to cutout video frame, and will be up and down part of the black side can be removed.
In python by
Frame=frame [40, 60, 420 0-6] # in proportion to cut out pictures (16:9==& gt; 640360) (4:3==& gt; 640480)
Processing.

CodePudding user response:

refer to the eighth floor weixin_46185214 response:
meet the same problem, also tried to capture (index + CAP_DSHOW), but no effect,
4th floor, brothers, python can only be addressed by clipping?

Quote: refer to 4th floor Thomson617 response:

Cutout processing the video frames, the top and bottom part of the black side can be removed.
In python by
Frame=frame [40, 60, 420 0-6] # in proportion to cut out pictures (16:9==& gt; 640360) (4:3==& gt; 640480)
Processing.

It is caused by the camera resolution, can be used by setting the camera internal parameters or child stream (RTSP) camera,

16:9 source flow according to every play will naturally appear black side of the situation

CodePudding user response:

references 9 f Thomson617 response:
Quote: refer to the eighth floor weixin_46185214 response:

Meet the same problem, but also tried to capture (index + CAP_DSHOW), and have no effect, however,
4th floor, brothers, python can only be addressed by clipping?

Quote: refer to 4th floor Thomson617 response:

Cutout processing the video frames, the top and bottom part of the black side can be removed.
In python by
Frame=frame [40, 60, 420 0-6] # in proportion to cut out pictures (16:9==& gt; 640360) (4:3==& gt; 640480)
Processing.

It is caused by the camera resolution, can be used by setting the camera internal parameters or child stream (RTSP) camera,

16:9 source flow according to every play nature presents black side of up and down

Thank you reply, just solved my problem, root cause is my cv2. After I set the resolution VideoCapture. Open (0), after that set the resolution with respect to ok,
  • Related