Ask Your Question

Revision history [back]

If you want only a part of your image, consider using ROI (Region Of Interest):

Mat A = imread("myimage.jpg", CV_LOAD_IMAGE_COLOR); // here we'll know the method used (allocate matrix
Mat D (A, Rect(10, 10, 100, 100) ); // using a rectangle
Mat E = A(Range:all(), Range(1,3)); // using row and column boundaries

Like presented here. You can use the ROI image directly, the headers of D and E and different from A, but they are pointing to the same data.

If you want only a part of your image, consider using ROI (Region Of Interest):

Mat A = imread("myimage.jpg", CV_LOAD_IMAGE_COLOR); // here we'll know the method used (allocate matrix
matrix)
Mat D (A, Rect(10, 10, 100, 100) ); // using a rectangle
Mat E = A(Range:all(), Range(1,3)); // using row and column boundaries

Like presented here. You can use the ROI image directly, the headers of D and E and different from A, but they are pointing to the same data.