Created
September 5, 2016 15:20
-
-
Save drhirsch/faf4c3259f8b6aed037d5f3beb293e59 to your computer and use it in GitHub Desktop.
Montage() for Matlab and Octave
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% note images must be exactly identically sized width x height | |
path = '~' | |
flist = {'1.png','2.png'}; % create this list with another function for real use | |
Nimg = length(flist); | |
finf = imfinfo([path,'/',flist(1).name]); | |
% this axis ordering needed by montage() | |
% third dimension is 1 for grayscale, 3 for color | |
oneorthree = 3; | |
data = zeros(finf.Height,finf.Width,oneorthree,Nimg); | |
for i = 1:Nimg | |
im = imread([path,'/',flist(i).name]); | |
data(:,:,oneorthree,i) = im; | |
end %for | |
% note optional 'DisplayRange' parameter to control contrast | |
montage(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment