normal_versus_mixed_clone.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * OpenCV seamlessCloning : Normal vs Mixed
  3. *
  4. * Copyright 2015 by Satya Mallick <spmallick@gmail.com>
  5. *
  6. */
  7. #include "opencv2/opencv.hpp"
  8. using namespace cv;
  9. using namespace std;
  10. int main( int argc, char** argv )
  11. {
  12. // Read images : src image will be cloned into dst
  13. Mat src = imread("images/iloveyouticket.jpg");
  14. Mat dst = imread("images/wood-texture.jpg");
  15. // Create an all white mask
  16. Mat src_mask = 255 * Mat::ones(src.rows, src.cols, src.depth());
  17. // The location of the center of the src in the dst
  18. Point center(dst.cols/2,dst.rows/2);
  19. // Seamlessly clone src into dst and put the results in output
  20. Mat normal_clone;
  21. Mat mixed_clone;
  22. seamlessClone(src, dst, src_mask, center, normal_clone, NORMAL_CLONE);
  23. seamlessClone(src, dst, src_mask, center, mixed_clone, MIXED_CLONE);
  24. // Write results
  25. imwrite("images/opencv-normal-clone-example.jpg", normal_clone);
  26. imwrite("images/opencv-mixed-clone-example.jpg", mixed_clone);
  27. }