I am not getting the thin image please solve this problem.

function img = loading
imagefolder='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);
end
tic
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');

1 件のコメント

uma
uma 2020 年 4 月 24 日
sir please tell me where is the wrong in the above code

サインインしてコメントする。

 採用された回答

Mehmed Saad
Mehmed Saad 2020 年 4 月 24 日

0 投票

add a slash at the end of imagefolder because currently you are looking at
imagefolder='C:\Users\Dell\Desktop\python tutorials\matlab\myfiles\matlab\myfiles\Dataset 1';
fileextension='.tif';
Type in coomand window
dir([imagefolder,'*',fileextension])
No matches for pattern 'C:\Users\Dell\Desktop\python tutorials\matlab\myfiles\matlab\myfiles\Dataset 1*.tif'.
and foldercontent will be empty
Now add a slash at the end of imagefolder
imagefolder='C:\Users\Dell\Desktop\python tutorials\matlab\myfiles\matlab\myfiles\Dataset 1\';
fileextension='.tif';
Now type in command window
dir([imagefolder,'*',fileextension])
foldercontent was empty when you gave it wrong path, now it has all the files *.tif

6 件のコメント

uma
uma 2020 年 4 月 24 日
Thank you for your response. I'm getting a single line in the thinning image . I just need the thinning images so that i can extract the minutiea points.
Mehmed Saad
Mehmed Saad 2020 年 4 月 24 日
like in a variable?
uma
uma 2020 年 4 月 24 日
yes
Mehmed Saad
Mehmed Saad 2020 年 4 月 24 日
you are storing all the images in img cell array, go for a similar approach
i dont want to be rude but is this your own code?
uma
uma 2020 年 4 月 24 日
thanks for the reply.
Yes i have written this code myself.
Mehmed Saad
Mehmed Saad 2020 年 4 月 24 日
cheers

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeImages についてさらに検索

質問済み:

uma
2020 年 4 月 24 日

コメント済み:

2020 年 4 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by