ofVideoGrabber - Relationship between the dimensions passed to initGrabber, actual grabber dimensions, and webcam resolution

In the documentation for initGrabber, there’s a section that reads:

If the capture dimensions are not available it will setup capture for the next closest dimensions available. It is good to check what the actual size is before you start processing the pixels.

Followed by some example code that prints the achieved dimensions:

myGrabber.initGrabber(320,240);
int grabW = myGrabber.getWidth();
int grabH = myGrabber.getHeight();
printf("asked for 320 by 240 - actual size is %i by %i", grabW, grabH);

What I’m confused about is that if I request a 320x240 grabber but my webcam’s capture resolution is 720p (1280x720), shouldn’t the actual size printed by the code above be something other than 320x240? Or does initGrabber automatically scale and/or crop the captured image to fit the dimensions (and only fails if it can’t somehow scale/crop the captured image)?

Its usually what are the different resolutions that the capture device or hardware supports.
A 1280 x 720 camera might allow for 3 or 4 other resolutions where the hardware or native capture api does the conversion.

I don’t believe OF scales the stream for you but that might depend on the platform.

Thanks for the reply - that makes sense.

Just wanted to follow up on this and share what I found out by experimenting in case others were curious. On my machine (a 2015 MacBook Pro), the camera does appear to do some cropping depending on the resolution requested by initGrabber. I tried digging into the function but I’m too out of practice with C++ to understand it. But I did capture a couple images to show the right and left edges getting cropped when I request a lower resolution: