Skip to content

Commit

Permalink
Fixed small inefficiency in seamless clone init
Browse files Browse the repository at this point in the history
  • Loading branch information
sajarin authored and asmorkalov committed Jan 14, 2020
1 parent a834513 commit 4b93820
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions modules/photo/src/seamless_cloning_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,8 @@ void Cloning::computeGradientX( const Mat &img, Mat &gx)
}
else if (img.channels() == 1)
{
Mat tmp[3];
for(int chan = 0 ; chan < 3 ; ++chan)
{
filter2D(img, tmp[chan], CV_32F, kernel);
}
merge(tmp, 3, gx);
filter2D(img, gx, CV_32F, kernel);
cvtColor(gx, gx, COLOR_GRAY2BGR);
}
}

Expand All @@ -78,12 +74,8 @@ void Cloning::computeGradientY( const Mat &img, Mat &gy)
}
else if (img.channels() == 1)
{
Mat tmp[3];
for(int chan = 0 ; chan < 3 ; ++chan)
{
filter2D(img, tmp[chan], CV_32F, kernel);
}
merge(tmp, 3, gy);
filter2D(img, gy, CV_32F, kernel);
cvtColor(gy, gy, COLOR_GRAY2BGR);
}
}

Expand Down

0 comments on commit 4b93820

Please sign in to comment.