1 | initial version |
If you want to cut out that roi by its parameters than you can do this by the following code snippet.
// Read image
Mat image = imread("/path/to/image");
// Define the roi
// Parameters are top left corner x, y followed by width and height of your roi
// Sample will cut out 100x100 pixels from the top left corner
Rect region_of_interest(0,0,100,100);
// Create a pointer to the roi in the original image
// Copy the data to a standalone matrix --> use a deep clone not only pointer reference copy
Mat temp (image, roi);
Mat ROI = temp.clone();
// Show the result
imshow("region of interest", ROI);