mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Merge pull request #12512 from sturkmen72:patch-1
This commit is contained in:
commit
14b438317e
@ -54,20 +54,27 @@ void cv::seamlessClone(InputArray _src, InputArray _dst, InputArray _mask, Point
|
|||||||
const Mat src = _src.getMat();
|
const Mat src = _src.getMat();
|
||||||
const Mat dest = _dst.getMat();
|
const Mat dest = _dst.getMat();
|
||||||
const Mat mask = _mask.getMat();
|
const Mat mask = _mask.getMat();
|
||||||
_blend.create(dest.size(), CV_8UC3);
|
dest.copyTo(_blend);
|
||||||
Mat blend = _blend.getMat();
|
Mat blend = _blend.getMat();
|
||||||
dest.copyTo(blend);
|
|
||||||
|
|
||||||
int minx = INT_MAX, miny = INT_MAX, maxx = INT_MIN, maxy = INT_MIN;
|
|
||||||
int h = mask.size().height;
|
|
||||||
int w = mask.size().width;
|
|
||||||
|
|
||||||
Mat gray;
|
Mat gray;
|
||||||
|
|
||||||
if(mask.channels() == 3)
|
if(mask.channels() == 3)
|
||||||
cvtColor(mask, gray, COLOR_BGR2GRAY );
|
cvtColor(mask, gray, COLOR_BGR2GRAY );
|
||||||
else
|
else
|
||||||
mask.copyTo(gray);
|
{
|
||||||
|
if (mask.empty())
|
||||||
|
gray = Mat(src.rows, src.cols, CV_8UC1, Scalar(255));
|
||||||
|
else
|
||||||
|
mask.copyTo(gray);
|
||||||
|
}
|
||||||
|
|
||||||
|
Mat gray_inner = gray(Rect(1, 1, gray.cols - 2, gray.rows - 2));
|
||||||
|
copyMakeBorder(gray_inner, gray, 1, 1, 1, 1, BORDER_ISOLATED | BORDER_CONSTANT, Scalar(0));
|
||||||
|
|
||||||
|
int minx = INT_MAX, miny = INT_MAX, maxx = INT_MIN, maxy = INT_MIN;
|
||||||
|
int h = gray.size().height;
|
||||||
|
int w = gray.size().width;
|
||||||
|
|
||||||
for(int i=0;i<h;i++)
|
for(int i=0;i<h;i++)
|
||||||
{
|
{
|
||||||
@ -102,7 +109,6 @@ void cv::seamlessClone(InputArray _src, InputArray _dst, InputArray _mask, Point
|
|||||||
|
|
||||||
Cloning obj;
|
Cloning obj;
|
||||||
obj.normalClone(destinationROI,sourceROI,maskROI,recoveredROI,flags);
|
obj.normalClone(destinationROI,sourceROI,maskROI,recoveredROI,flags);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::colorChange(InputArray _src, InputArray _mask, OutputArray _dst, float red, float green, float blue)
|
void cv::colorChange(InputArray _src, InputArray _mask, OutputArray _dst, float red, float green, float blue)
|
||||||
|
Loading…
Reference in New Issue
Block a user