Skip to content

Commit ca83009

Browse files
authored
Merge pull request #189 from saeugetier/feature/188-gaussian-blur-alpha-mask
use gaussian blur in order to blur the mask
2 parents c96119d + eae996f commit ca83009

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/replacebackgroundvideofilter.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ void ReplaceBackgroundFilterRunable::run(const QVariant& variant, bool applyBack
217217
else
218218
{
219219
mYoloSegmentorSlow.drawSegmentationMask(mask, results, objectFilter);
220+
// use a gaussian blur for the mask in order to make it less sharp
221+
// kernel size of 30 is determined by experiment
222+
cv::GaussianBlur(mask, mask, cv::Size(30,30), 0, 0);
220223
}
221224

222225
std::vector<cv::Mat> channels;
@@ -373,6 +376,8 @@ cv::Mat ReplaceBackgroundFilterRunable::grabcutChromaKey(const cv::Mat& img, con
373376

374377
cv::dilate(final_mask, final_mask, element);
375378

379+
// use a gaussian blur for the mask in order to make it less sharp
380+
cv::GaussianBlur(final_mask, final_mask, cv::Size(30,30), 0, 0);
376381

377382
// Extract the foreground
378383
cv::Mat fg, bg;

0 commit comments

Comments
 (0)