I have an image with size 640x400 and i need to crop the defined borders, so 5 px from each side. So, the end image will 630x390 and without the borders. What is the easiest way to do in with openCV in c++.
Simple:
int padding = 5;
cv::Mat crop = cv::Mat(img, cv::Rect(padding, padding, img.cols - 2 * padding, img.rows - 2 * padding));