필터 지우기
필터 지우기

Blurred edges of roipoly

조회 수: 1 (최근 30일)
Jessica Yorzinski
Jessica Yorzinski 2022년 9월 2일
댓글: Jessica Yorzinski 2022년 9월 2일
I am using the below script to overlay two images. I create an ROI so that the output shows one of the images but with a cut-out revealing the other image. Can anyone suggest how to make the edges of the ROI cut-out softer/blurred so that the ROI blends better with the other image?
clear all
rgb = imread('Image1.png');
imshow(rgb);
BW = roipoly(rgb);
rgb = imread('Image1.png');
imshow(rgb);
I = imread('Image2.png');
hold on
h = imshow(I);
hold off
set(h, 'AlphaData', BW);

답변 (1개)

Image Analyst
Image Analyst 2022년 9월 2일
You could blur the overlay image and then replace the overlay image in a neighborhood of the edge of the BW with the blurred version. Try it.
  댓글 수: 1
Jessica Yorzinski
Jessica Yorzinski 2022년 9월 2일
I understand how to blur the image, using something like this:
windowSize = 30;
kernel = ones(windowSize) / windowSize^2;
blurredImage = imfilter(I2, kernel);
But, how would I place this atop the edge of BW?

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by