Skip to content

Instantly share code, notes, and snippets.

@hkhojasteh
Last active January 30, 2019 05:28
Show Gist options
  • Save hkhojasteh/259cd19c83e9bb58eb29fb6848841a56 to your computer and use it in GitHub Desktop.
Save hkhojasteh/259cd19c83e9bb58eb29fb6848841a56 to your computer and use it in GitHub Desktop.
Mat3b img = imread(argv[1]); //Load image
Rect roi(0, 420, img.cols, img.rows - 500); //Setup a rectangle to define region of interest
Mat3b img_crop = img(roi); //Crop the full image to rectangle ROI
Mat img_gray;
cvtColor(img_crop, img_gray, CV_BGR2GRAY); //Convert image to gray
//Show results
imshow("Original", img);
imshow("Crop", img_crop);
imshow("Gray", img_gray);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment