1 | initial version |
drawPatch (cv::Mat img) or drawCorner(cv::Mat img) it's not a copy of an image, it is jsu a copy of all Mat member : member data is copied too then pixels are at same location in memory.
If you want a copy you must clone image before calling function :
Mat img2=img.clone(),img3=img.clone();
imshow("1", img);
drawCorner(img2);
imshow("2", img2); // it shows the original img, with drawn corners. no reference as input.
drawPatch(img3);
imshow("3", img3); // it shows the drawn rectangle even no reference as input.
2 | No.2 Revision |
drawPatch (cv::Mat img) or drawCorner(cv::Mat img) it's not a copy of an image, it is jsu a copy of all Mat member : member data is copied too then pixels are at same location in memory.
If you want a copy you must clone image before calling function :
Mat img2=img.clone(),img3=img.clone();
imshow("1", img);
drawCorner(img2);
imshow("2", img2); // it shows the original img, with drawn corners. no reference as input.
drawPatch(img3);
imshow("3", img3); // it shows the drawn rectangle even no reference as input.