Last active
March 8, 2021 09:05
-
-
Save ericosur/f11d74707f91df5a18b524fff203a698 to your computer and use it in GitHub Desktop.
opencv crop ROI of an image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You mention that you start with a CVMat* imagesource | |
CVMat * imagesource; | |
// Transform it into the C++ cv::Mat format | |
cv::Mat image(imagesource); | |
// Setup a rectangle to define your region of interest | |
cv::Rect myROI(10, 10, 100, 100); | |
// Crop the full image to that image contained by the rectangle myROI | |
// Note that this doesn't copy the data | |
cv::Mat croppedImage = image(myROI); | |
// from: https://stackoverflow.com/questions/8267191/how-to-crop-a-cvmat-in-opencv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment