Ask Your Question
0

Video Capture Resolution Issue on Windows

asked 2018-07-10 03:17:51 -0600

cardiacmirror gravatar image

updated 2018-07-10 05:18:52 -0600

Hi,

I've been trying to just do a simple Video capture feed with open cv but i have a problem with the resolution of the feed. The video feed defaults into 640 x 480 resolution but I know the camera can achieve a higher resolution. I tested on the windows camera app and i was able to get 1920 x 1080 resolution. I have already tried setting the height and width of the video capture through the use of

cap.set(CV_CAP_PROP_FRAME_WIDTH,1920);

cap.set(CV_CAP_PROP_FRAME_HEIGHT,1080);

This results in the video capture having that resolution but the the sides are filled with black pixels and the image does not look like the appropriate resolution.

I am programming this in a windows environment on Visual Studio 2017. The camera I'm using is the Logitech HD Webcam C615. I'm using Open CV 3.4.2

Cheers

edit retag flag offensive close merge delete

Comments

but I know the camera can achieve a higher resolution

most cameras have a better resolution for still images, and a worse one for streaming video.

berak gravatar imageberak ( 2018-07-10 03:35:39 -0600 )edit

The specification of the camera says it can achieve HD video calls at 720p. I have also been able to use the camera at 1080p video stream on LabView. I don't think its an issue with the camera

cardiacmirror gravatar imagecardiacmirror ( 2018-07-10 03:44:37 -0600 )edit

if you have it, try the MSMF backend: cap.open(0,CAP_MSMF); or dshow: cap.open(0,CAP_DSHOW);

(maybe it's trying the outdated vfw one first)

if you have recent 3.4.2, you can also set an env var to debug it:

set OPENCV_VIDEOIO_DEBUG=TRUE

(then run your program again, it will show you, in which order the backends are tried, and what was used to open your cam)

berak gravatar imageberak ( 2018-07-10 03:53:25 -0600 )edit

I have tried both APIs, the only one that gives me the video capture is dshow but it is at 640 x 480 but this was tested without setting the env var and the video feed was opened individually to see if the program crashed or not. I can try again tomorrow as my setup is at the university.

cardiacmirror gravatar imagecardiacmirror ( 2018-07-10 03:58:28 -0600 )edit

Hey thanks for the help I managed to get it working with your advice. I tried both back end APIs. I was able to get a video capture through both of them but they both were still defaulted to 640 x 480 resolution. I then manually tried setting the resolution again through

cap.set(CV_CAP_PROP_FRAME_WIDTH,1280);

cap.set(CV_CAP_PROP_FRAME_HEIGHT,720);

With MSMF the results were the same but with dshow i was able to get the proper video feed.

Thanks for your help.

cardiacmirror gravatar imagecardiacmirror ( 2018-07-10 18:15:43 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-07-12 20:14:17 -0600

cardiacmirror gravatar image

Hey thanks for the help I managed to get it working with your advice. I tried both back end APIs. I was able to get a video capture through both of them but they both were still defaulted to 640 x 480 resolution. I then manually tried setting the resolution again through

cap.set(CV_CAP_PROP_FRAME_WIDTH,1280);

cap.set(CV_CAP_PROP_FRAME_HEIGHT,720);

With MSMF the results were the same but with dshow i was able to get the proper video feed.

Thanks for your help.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-07-10 03:17:51 -0600

Seen: 6,899 times

Last updated: Jul 12 '18