forked from spmallick/learnopencv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnormal_versus_mixed_clone.cpp
39 lines (27 loc) · 1.01 KB
/
normal_versus_mixed_clone.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* OpenCV seamlessCloning : Normal vs Mixed
*
* Copyright 2015 by Satya Mallick <spmallick@gmail.com>
*
*/
#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
// Read images : src image will be cloned into dst
Mat src = imread("images/iloveyouticket.jpg");
Mat dst = imread("images/wood-texture.jpg");
// Create an all white mask
Mat src_mask = 255 * Mat::ones(src.rows, src.cols, src.depth());
// The location of the center of the src in the dst
Point center(dst.cols/2,dst.rows/2);
// Seamlessly clone src into dst and put the results in output
Mat normal_clone;
Mat mixed_clone;
seamlessClone(src, dst, src_mask, center, normal_clone, NORMAL_CLONE);
seamlessClone(src, dst, src_mask, center, mixed_clone, MIXED_CLONE);
// Write results
imwrite("images/opencv-normal-clone-example.jpg", normal_clone);
imwrite("images/opencv-mixed-clone-example.jpg", mixed_clone);
}