컴퓨터비전/영상처리/OpenCV
OpenCV SeamlessCloning
object0814
2015. 7. 30. 04:49
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 | // Examples : seamlessClone.cpp // Using OpenCV 3.0 version #include <cv.hpp> using namespace std; using namespace cv; int main() { Mat src = imread("img/iloveyouticket.jpg"); Mat dst = imread("img/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 result in output Mat normal_clone, mixed_clone; seamlessClone(src, dst, src_mask, center, normal_clone, NORMAL_CLONE); seamlessClone(src, dst, src_mask, center, mixed_clone, MIXED_CLONE); namedWindow("normal_clone"); imshow("normal_clone", normal_clone); namedWindow("mixed_clone"); imshow("mixed_clone", mixed_clone); waitKey(0); return 0; } | cs |
입력 이미지 예1)
<그림 1 source image>
<그림 2 dst image>
<그림 3 normal clone>
<그림 4 mixed clone>
입력 이미지 예2)
<그림 5 source image>
<그림 6 dst image>
normal clone
<그림 7 normal clone>
mixed clone
<그림 8 mixed clone>