OpenCV / C++: Adding feather to the content of a shape in cv::Mat

asked 2016-08-30 08:19:12 -0500

zealotfb gravatar image

Hi there

I have an image (irregular shaped) in some part of a cv::Mat object (cv::Mat(750, 750, CV_8UC4))

I would like to add 15px wide feather to around the shape in the cv::Mat object with some blur effect. Please note that I don't want to add blur to the shape itself. I need it added to the outside of the shape.

If you could please help me to achieve that, that would be much appreciated.

Hope the question makes sense.

Cheers

edit retag flag offensive close merge delete

Comments

anyone using CV_8UC4 is not doing computer-vision, but plain image-processing (abuse of library ?).

berak gravatar imageberak ( 2016-08-30 08:31:17 -0500 )edit

What have you tried? Show us your code!

Balaji R gravatar imageBalaji R ( 2016-08-30 09:20:37 -0500 )edit

I have tried this but no luck!

int FEATHER_AMOUNT = 60; cv::Size blurSize = cv::Size(FEATHER_AMOUNT, FEATHER_AMOUNT); cv::resize(outputImage, outputImage, cv::Size(outputImage.rows + FEATHER_AMOUNT * 2, outputImage.cols + FEATHER_AMOUNT * 2)); outputImage = outputImage(cv::Rect(FEATHER_AMOUNT, FEATHER_AMOUNT, outputImage.rows - FEATHER_AMOUNT * 2, outputImage.cols - FEATHER_AMOUNT * 2)); cv::GaussianBlur(outputImage, outputImage, blurSize, 0);

zealotfb gravatar imagezealotfb ( 2016-08-30 09:57:15 -0500 )edit