Commit 6a15910f authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

Merge pull request #11208 from terfendail:seamless_1

parents 29869c5b eb2c9f15
...@@ -75,26 +75,26 @@ void cv::seamlessClone(InputArray _src, InputArray _dst, InputArray _mask, Point ...@@ -75,26 +75,26 @@ void cv::seamlessClone(InputArray _src, InputArray _dst, InputArray _mask, Point
{ {
if(gray.at<uchar>(i,j) == 255) if(gray.at<uchar>(i,j) == 255)
{ {
minx = std::min(minx,i); miny = std::min(miny,i);
maxx = std::max(maxx,i); maxy = std::max(maxy,i);
miny = std::min(miny,j); minx = std::min(minx,j);
maxy = std::max(maxy,j); maxx = std::max(maxx,j);
} }
} }
} }
int lenx = maxx - minx; int lenx = maxx - minx + 1;
int leny = maxy - miny; int leny = maxy - miny + 1;
int minxd = p.y - lenx/2; int minxd = p.x - lenx/2;
int maxxd = p.y + lenx/2; int minyd = p.y - leny/2;
int minyd = p.x - leny/2; int maxxd = minxd + lenx;
int maxyd = p.x + leny/2; int maxyd = minyd + leny;
CV_Assert(minxd >= 0 && minyd >= 0 && maxxd <= dest.rows && maxyd <= dest.cols); CV_Assert(minxd >= 0 && minyd >= 0 && maxxd <= dest.rows && maxyd <= dest.cols);
Rect roi_d(minyd,minxd,leny,lenx); Rect roi_d(minxd,minyd,lenx,leny);
Rect roi_s(miny,minx,leny,lenx); Rect roi_s(minx,miny,lenx,leny);
Mat destinationROI = dest(roi_d).clone(); Mat destinationROI = dest(roi_d).clone();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment