Created
October 15, 2015 09:19
-
-
Save jnkather/1b3f6f292c0e0ccbb06c to your computer and use it in GitHub Desktop.
create thumbnails of large images using Matlab blockproc and parallel processing
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
IMpath = 'C:\folder\input\'; % specify input/output folder | |
allImgs = {'filename1.tif',... | |
'filename2.tif'}; % specify filenames | |
% iterate through all images | |
for i=1:numel(allImgs) | |
fun = @(block_struct) imresize(block_struct.data,0.1); | |
imgOut = blockproc([IMpath,char(allImgs{i})],... | |
[1000 1000],fun,... | |
'UseParallel',true,... | |
'PadPartialBlocks',false); | |
imwrite(imgOut,[IMpath,char(allImgs{i}),'-THUMB10.tif']); | |
clear imgOut | |
disp('DONE image'); | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment