If we don't have the same aspect ratio for the camera and the video output the result is not very pretty.
For this case, we can calculate the region we will scale. For example, if --cg is 640x480 and --vg is 480x480, we my calculate the region to be processed and set
cv::Rect crop_region(80, 0,480, 480);
and call
cv::resize(raw(crop_region), raw, cv::Size(vidGeo.value().first,vidGeo.value().second));
instead of
cv::resize(raw raw, cv::Size(vidGeo.value().first,vidGeo.value().second));
This allows to get a non distorted output.
If we don't have the same aspect ratio for the camera and the video output the result is not very pretty.
For this case, we can calculate the region we will scale. For example, if --cg is 640x480 and --vg is 480x480, we my calculate the region to be processed and set
and call
instead of
This allows to get a non distorted output.