Multiple output images from function
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Joe Beard
am 2 Mai 2020
Bearbeitet: Ameer Hamza
am 3 Mai 2020
The length of column 1 in bboxout is an unknown, how do I adjust my code to output each iteration of ROI_RGB?
If I use figure, imshow in the for loop each image is displayed, however I need to acces the data for each image seperately outside of the function.
function [ROI_RGB] = cleanup(bboxout, I1)
for i=1:length(bboxout)
%Crop out region of interest
ROI_RGB = imcrop(I1, bboxout(i,:));
end
end
0 Kommentare
Akzeptierte Antwort
Ameer Hamza
am 2 Mai 2020
Bearbeitet: Ameer Hamza
am 2 Mai 2020
Use cell array
function [ROI_RGB] = cleanup(bboxout, I1)
ROI_RGB = cell(1, size(bboxout,1));
for i=1:size(bboxout,1)
%Crop out region of interest
ROI_RGB{i} = imcrop(I1, bboxout(i,:));
end
end
You can access elements of cell array using brace indexing
ROI_RGB{1} % first element
ROI_RGB{2}
..
..
ROI_RGB{end}
4 Kommentare
Ameer Hamza
am 3 Mai 2020
Bearbeitet: Ameer Hamza
am 3 Mai 2020
ISoR is a cell array. To display an image, you need to use indexing
imshow(ISoR{1}) % display first image
imshow(ISoR{2})
..
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

