folder1 = 'C:\somewhere\somefolder';
folder2 = 'C:\somewhere\someotherfolder';
folderout = 'C:\anothersomewhere\something';
outfilepattern = 'FancyName%03d.tif';
filelist1 = dir(fullfile(folder1, '*.tif'));
filelist2 = dir(fullfile(folder2, '*.tif'));
assert(numel(filelist1) == numel(filelist2), 'Mismatch between file count in input folders.');
filelist1 = natsortfiles({filelist1.name});
filelist2 = natsortfiles({filelist2.name});
for fidx = 1:numel(filelist1)
img1 = imread(fullfile(folder1, filelist1{fidx}));
img2 = imread(fullfile(folder2, filelist2{fidx}));
img_fuse = imfuse(img1, img2, 'montage');
imwrite(img_fuse, fullfile(folderout, sprintf(outfilepattern, fidx)));
end
4 Comments
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/510353-how-two-fuse-two-sets-of-images#comment_808621
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/510353-how-two-fuse-two-sets-of-images#comment_808621
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/510353-how-two-fuse-two-sets-of-images#comment_808632
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/510353-how-two-fuse-two-sets-of-images#comment_808632
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/510353-how-two-fuse-two-sets-of-images#comment_808642
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/510353-how-two-fuse-two-sets-of-images#comment_808642
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/510353-how-two-fuse-two-sets-of-images#comment_808648
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/510353-how-two-fuse-two-sets-of-images#comment_808648
Sign in to comment.