Guest User

Untitled

a guest
Aug 14th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. How to make a deep copy of a rectangular region of a cv::Mat?
  2. // select a ROI
  3. Mat roi(img, Rect(10,10,100,100));
  4.  
  5. Mat deepRoiExplorer=roi.clone();
  6.  
  7. Mat source...; // your source image
  8. Rect sourceRect(...); // your ROI
  9.  
  10. // using clone
  11. Mat target = source(sourceRect).clone();
  12.  
  13. // using copyTo
  14. Mat target(sourceRect.size(), source.type());
  15. source(sourceRect).copyTo(target);
Add Comment
Please, Sign In to add comment