简体   繁体   English

模糊图像的非矩形区域,然后对整个图像进行下采样-OpenCV

[英]Blurring non-rectangular region of an image, then downsample whole image - OpenCV

I am using OpenCV3 to blur and downsample an image, I just want to blur the region inside the area defined by a binary mask like: 我正在使用OpenCV3对图像进行模糊处理和降采样处理,我只想对二进制掩码定义的区域内的区域进行模糊处理,例如:

在此处输入图片说明

After that region is blurred, I would like to downsample the image without blurring the whole image again, so pyrDown is not useful for me. 在该区域模糊之后,我想对图像进行下采样而不再次模糊整个图像,因此pyrDown对我没有用。

Any idea? 任何想法?

Tricky way: 棘手的方式:

cv::Mat roi;
cv::blur(image & mask,roi,cv::Size(3,3));//Or whatever blurring you want
cv::Mat Result=(image & (~mask)) + roi;
cv::resize(result,result,cv::Size(New_Width,New_height)); // Or whatever downsampling you want

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM