clc;clear;close all
im=imread("coloredChips.png");
imshow(im);
for i=1:6
h(i)=drawcircle;
end
for i=1:6
mask.a(i)=h(i).createMask;
end
im1=inpaintCoherent(im,mask,"SmoothingFactor",0.5);
figure;imshow(im1)

댓글 수: 5

Amir Azadeh Ranjbar
Amir Azadeh Ranjbar 2021년 12월 28일
hello
i want creat one mask by drawing (for example 6 circles)
but not work
Amir Azadeh Ranjbar
Amir Azadeh Ranjbar 2021년 12월 28일
mask1=h(1).createMask;
imshow(mask1)
but not ok when use for loop
Rik
Rik 2021년 12월 28일
What does 'not ok' mean?
Note that imshow will wipe a lot of settings for an axes. Also, the code you posted uses arrays (which is good), but your final suggestion uses numbered variables (which is bad).
Amir Azadeh Ranjbar
Amir Azadeh Ranjbar 2021년 12월 28일
i want save masks and use or | operation to eliminate from orginal image
Rik
Rik 2021년 12월 28일
If you start with an array with only true, I don't see why using | wouldn't work. I don't see why you would need numbered variables.
I'm on mobile, so I can't run your code to test it. Is it returning an object instead of a binary image?

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

 채택된 답변

DGM
DGM 2021년 12월 28일
편집: DGM 2021년 12월 28일

0 개 추천

This is a start
im = imread("coloredChips.png");
numROI = 6;
% create ROI objects and adjust them
imshow(im);
for k = 1:numROI
h(k) = drawcircle;
end
% wait until the user is done
input('Press enter when done adjusting ROI objects');
% build mask
mask = false(size(im,1),size(im,2));
for k = 1:numROI
mask = mask | createMask(h(k));
end
inpaintedimage = inpaintCoherent(im,mask,"SmoothingFactor",0.5);
%figure;
imshow(inpaintedimage)

추가 답변 (0개)

태그

질문:

2021년 12월 28일

댓글:

2021년 12월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by