How to use a function in a loop for whole database in image processing using MatLab

4 Ansichten (letzte 30 Tage)
I have a code for finding a skeleton of an image. I want to use that code to find the skeleton of all frames present in a folder as separate images. These image are named sequentially, such as 001-nm-01-090-062.png, 001-nm-01-090-063.png, 001-nm-01-090-064.png etc. I want to store the skeletonized image in a separate folder.
The code for skeleton is
% read in a sample image --
img = imread('C:\Users\anurag\Desktop\090\001-nm-01-090-064.png');
img=im2bw(img,.5);
imshow(img);
% the standard skeletonization:
imshow(bwmorph(img,'skel',inf));
% the new method:
imshow(bwmorph(skeleton(img)>35,'skel',Inf));

Antworten (1)

KSSV
KSSV am 29 Dez. 2016
imgFiles = dir('*.png'); % get all png files in the folder
numfiles = length(imgFiles); % total number of files
for k = 1:numfiles % loop for each file
img = imgFiles(k).name % present image file
%%do what you want %%
end

Kategorien

Mehr zu Images finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by