function img = loadingimagefolder='C:\Users\Dell\Desktop\python tutorials\matlab\myfiles\matlab\myfiles\Dataset 1';fileextension='.tif';img=cell(1);foldercontent=dir([imagefolder,'*',fileextension]); % loads images in foldercontent variable.
n=size(foldercontent,1);[filename, pathname] = uigetfile('*.tif', 'Pick an Image'); if isequal(filename,0) || isequal(pathname,0) warndlg('Image is not selected'); else a=imread(fullfile(pathname,filename)); imshow(a); endtic for i=1:n disp(i); string = [imagefolder,foldercontent(i,1).name]; image =imread(string); img{i,1}=string; img{i,2}=image;binary_image1=im2bw(img{i,2});%Small region is taken to show output clear
binary_image = binary_image1(20:100,20:150);figure;imshow(binary_image);title('Binary image');%Thinning
thin_image=~bwmorph(binary_image,'thin',Inf);figure;imshow(thin_image);title('Thinned Image');
MATLAB: I am not getting the thin image please solve this problem.
thinning image
Best Answer