kibsoft / QtMEL

Qt Media Encoding Library
GNU Lesser General Public License v2.1
67 stars 16 forks source link

Maximum size 640x480? #37

Closed fransschreuder closed 7 years ago

fransschreuder commented 7 years ago

Hi, I am using the CameraExample, or at least something derived from it. I am using the Logitech C930e webcam which is supposed to have HD resolution, however the maximum frame size reported by QtMel is 640x480. Is there a workaround for this? Thanks

kibsoft commented 7 years ago

Hello CameraGrabber::maximumFrameSize returns 640x480?

kibsoft commented 7 years ago

Which version of OpenCV do you use? As far as I remember that was a bug in it. Just use setSize to set wanted size of the frame (but the image may be scaled). So, in order to use native resolution of the camera you should use the latest OpenCV library and also try to set the size explicitly (by changing the QtMEL sources). It seems OpenCV has changed its API since I worked on QtMEL, so I am not sure I can help you.

fransschreuder commented 7 years ago

Ok, thanks for your quick answer! I have used the binaries from your site. I will try with the latest OpenCV.

fransschreuder commented 7 years ago

I built everything with opencv 2.4.13. I still get m_cameraGrabber->maximumFrameSize(m_selectedCamera); 640x480 I can do m_recorder->encoder()->setVideoSize(QSize(1920,1080)); This actually gives me a video with the correct size, however only the video shows op in the top left corner at 640x480px, the rest of the frame is green. When I make the cameragrabber also 1920x1080: m_cameraGrabber->setSize(QSize(1920,1080)); The cameraGrabber actually shows the correct size on the display, but the recorded video becomes a very small unusable file.

fransschreuder commented 7 years ago

Oh, I was stupid: I had to set the Grabber frame size before m_recorder->setImageGrabber(m_cameraGrabber); It's more or less working now, although unstable. (application crashes few seconds after recording)

kibsoft commented 7 years ago

Where does it crash? That is why I freezed development of QtMEL. Backends (ffmpeg and OpenCV) are unstable sometime, they crash without any reason.

fransschreuder commented 7 years ago

The crashing was my fault I guess, it is fixed now. As you told before the image actually gets scaled from 640x480, it doesn't take the camera resolution. I have created a pull request to actually set the OpenCV resolution when you change the camera grabber resolution

kibsoft commented 7 years ago

Thanks for contributing! I've merged it.

fransschreuder commented 7 years ago

thanks!