Effacer les filtres
Effacer les filtres

Saving an annotated drawrectangle image to the workspace

4 vues (au cours des 30 derniers jours)
Aaron Devanathan
Aaron Devanathan le 26 Juil 2021
Modifié(e) : Yongjian Feng le 26 Juil 2021
Good afternoon, all. I have an image on which I am annotating it with a series of rectangles. The image and coordinates are already loaded into the workspace. I've placed the code I am using below to create annotate the regions of interest. I am happy to revise based on if additional information is needed.
My question is: when I do this, it will show up in the image viewer, but is there a way to store this newly annotated figure in the MATLAB workspace? I'd like to do more image processing on it in later steps.
numberofrectangles=size(Annotations,1);
img_A=false(dims.(1),dims.(2));
figure('Position',[1 1 dims.(2) dims.(1)])
imshow(img_adjusted)
axis image;
hold on;
for k = 1 : numberofrectangles
w=(Annotations(k,3)-Annotations(k,1));
h=(Annotations(k,4)-Annotations(k,2));
rect=drawrectangle('Position',[Annotations(k,1),Annotations(k,2),w,h],'Color','g','LineWidth',1, 'InteractionsAllowed', 'none');
roi=createMask(rect);
for j = 1 : dims.(1)
for n = 1 : dims.(2)
if roi(j,n)==1
img_A(j,n)=1;
end
end
end
end

Réponse acceptée

Yongjian Feng
Yongjian Feng le 26 Juil 2021
Modifié(e) : Yongjian Feng le 26 Juil 2021

Plus de réponses (0)

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by