Borrar filtros
Borrar filtros

The code cannot read it says path not found and

1 visualización (últimos 30 días)
ASMA MOHAMMAD
ASMA MOHAMMAD el 3 de Jun. de 2021
Comentada: Steven Lord el 5 de Jun. de 2021
clc
close all
clear all
clc
close all
clear all
imgpath{4}= 'D:\MATLAB\Finger_Knuckle_Print_Original_Database\Left_Index_Finger_165\';
fd4=fopen('loglist_Left_Index.txt','rt'); % 294 subjects Train Total train = 493
feat1=[];
k=6;
for i=1:165
txt1=fscanf(fd4,'%s\n',1);
for j=1:6
fn1=sprintf('%s/%s index/0%iROI.jpg',imgpath{4},txt1,j);%u01000s0001_fnf1.jpg
img1= imread (fn1);
  1 comentario
Steven Lord
Steven Lord el 5 de Jun. de 2021
You have asked this question 1, 2, 3, and 4 times and received answers and/or comments on three of those questions.
Asking the same thing multiple times is not necessarily likely to get you different answers. It's likely to get you the same answer multiple times.
Please pick one of these questions and continue the discussion in that one question. Please don't ask this a fifth time.

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 3 de Jun. de 2021
Does it say that for the fopen() or for the imread()?
fn1=sprintf('%s/%s index/0%iROI.jpg',imgpath{4},txt1,j);%u01000s0001_fnf1.jpg
That sprintf() does not construct a filename that looks like u01000s0001_fnf1.jpg . It constructs a file name that has an initial 0, followed by a variable number of digits, followed by ROI.jpg . So for example 01ROI.jpg, 012.ROI.jpg 0123.ROI.jpg .
Chances are that you should be using at %04d format (or similar) instead of a 0%i format.
  2 comentarios
ASMA MOHAMMAD
ASMA MOHAMMAD el 3 de Jun. de 2021
Error using imread (line 349)
File "D:\MATLAB\Finger_Knuckle_Print_Original_Database\Left_Index_Finger_165\/ index/0001
iROI.jpg" does not exist.
Error in feat (line 13)
img1= imread (fn1);
Walter Roberson
Walter Roberson el 3 de Jun. de 2021
Your existing code
fn1=sprintf('%s/%s index/0%iROI.jpg',imgpath{4},txt1,j);%u01000s0001_fnf1.jpg
cannot produce 0001iROI.jpg . It would produce 01ROI.jpg instead.
If you are following my suggestion of something like %04d then you accidentally left in the i and would use something like
fn1=sprintf('%s/%s index/%04dROI.jpg',imgpath{4},txt1,j);%u01000s0001_fnf1.jpg
which would produce 0001ROI.jpg
But we are guessing here about the exact filenames that are in your directory. In your directory, what is the filename corresponding to j = 1, and what is the filename corresponding to j = 10 ?

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by