How to crop rect (rectangular) image from other image? Resolved!

  • im is bigger image (for example face)
  • sub is cropped smaller image (for example face's eyeblow)
            Mat sub = new Mat();
            int xStart = 500;
            int xEnd = 800;
            int yStart = 500;
            int yEnd = 800;
            im.submat(yStart, yEnd, xStart, xEnd).copyTo(sub);
            Debug.Log(sub.size().width);
            sub.copyTo(im);
  • submat parameter order is y, y, x, x. Take care.

Learning OpenCV 3: Computer Vision in C++ with the OpenCV Library (English Edition)

Learning OpenCV 3: Computer Vision in C++ with the OpenCV Library (English Edition)