How can I have different ROIs (Region Of Interest) in a image using imellipse?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
azim
am 15 Dez. 2015
Kommentiert: azim
am 16 Dez. 2015
I am making a GUI in Matlab to show an image and select a ROI on it. Please see the following code:
clear all
close all
clc
a=imread('rice.png');
I=imshow (a);
e = imellipse(gca,[]);
BW = createMask(e,I);
ROI = a;
ROI(BW == 0) = 0;
figure,imshow (ROI);
Now, I want have different ROIs from the first image (rice.png), by dragging and resizing the ROI on the image and without running the code again. Could you please help me in this regard? Thank you very much
1 Kommentar
Image Analyst
am 15 Dez. 2015
Do you want multiple ellipse ROIs on the image simultaneously, or do you just want to use one ellipse at a time?
Akzeptierte Antwort
harjeet singh
am 15 Dez. 2015
hello azim
this code will help you, do change for for loop for the number of iterations you want
clear all
close all
clc
a=imread('rice.png');
figure(1)
I=imshow(a);
drawnow
ROI_main(1:size(a,1),1:size(a,2))=0;
ROI_main=uint8(ROI_main);
for i=1:5
e = imellipse(gca,[]);
BW = createMask(e,I);
ROI = a;
ROI(BW == 0) = 0;
ROI_main=(ROI_main .* uint8(~BW)) + ROI;
figure(2)
imshow (ROI_main);
drawnow
figure(1)
end
figure(2)
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!