bytedeco/javacv

VideoInputFrameGrabber use the default format

Open

#1,104 opened on Dec 6, 2018

View on GitHub
 (6 comments) (0 reactions) (0 assignees)Java (1,583 forks)batch import
bughelp wanted

Repository metrics

Stars
 (6,985 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

I'm trying to capture images from a webcam, I've tried using OpenCVFrameGrabber and FFmpegFrameGrabber, they give me errors. Now I'm using VideoInputFrameGrabber, I found out that I have to set the image width and height, otherwise it says ERROR: SampleCB() - buffer sizes do not match. It has already printed the default format in the console:

SETUP: Setting up device 1
SETUP: MJPEG Camera
SETUP: Default Format is set to 2048 by 1536 
SETUP: trying requested format RGB24 @ 640 by 480
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.

2048x1536 is my webcam's size. If it sets the format to 640x480, I get a ERROR: SampleCB() - buffer sizes do not match. Could anyone tell me a way that can make VideoInputFrameGrabber set the correct image width and height automatically?

Contributor guide