How to perform imopen on ROI without affecting other region
Hello, I tried to perform imopen function only on ROI without affecting other region but got error. My input image is human’s iris in greyscale format.
i=imread('snowflakes.png'); %input image
h=imshow(i);
e=imellipse(gca,[60 45 60 60]); %ROI is ellipse shape at the center of image
mask=createMask(e,h); %mask of center image
j=imopen(mask,strel('disk',5)); %imopen
m=roifilt2(j,i,mask); %imopen on ROI, other region not affected
imshow(m)
“Error using imfilter Expected input number 2, H, to be one of these types: double Instead its type was logical.”
NOTE:-
Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.
The thing you’re doing isn’t what you think you’re doing. You’re opening the elliptical mask itself, not the image. You’re then using the logical mask as the filter kernel in a linear filtering operation. Neither make sense.
If you really want to use roifilt2() for this, you can.
% read image
inpict = imread('snowflakes.png'); % input image
% create elliptical mask using ROI tools
hi = imshow(inpict);
emask = imellipse(gca,[60 45 60 60]); % ROI is ellipse shape at the center of image
mask = createMask(emask,hi); % mask of center imagef = @(x) imopen(x,strel('disk',5)); % create function handle
opened = roifilt2(inpict,mask,f); % imopen on ROI, other region not affected
imshow(opened)
SEE COMPLETE ANSWER CLICK THE LINK