2017-11-19 1 views
0

Ich möchte alle Bilder in bestimmten Ordner lesen und speichern Sie es in 64 * 64 Größe JPG-Bilder.Warum passiert Get_full_filename Fehler in Matlab?

Aber der Fehler auftritt und ich weiß nicht warum und was zu tun ist. Pleaes helfen mir

Fehlercode:

File "Nikon_D70_0_19458.tif" doesn't exist 

Error: imread (line 340) fullname = get_full_filename(filename); 

Error: Untitled (line 13) dList(i).data = imread(dList(i).name); 

Mein Code:

clc; clear; close all; 
imgPath = 'C:\Users\LG\Desktop\TIFF\dataset1\60\'; %open image path 

dList = dir([imgPath '*.tif']); name = 1; %save name index 

for i=1:length(dList) %open image dList(i).data = imread(dList(i).name); 
    dList(i).data = dList(i).data(1:256 ,1:256,:); %crop image 256*256 
    a = dList(i).data; 
    YCbCr = rgb2ycbcr(a); 
    Y = YCbCr(:,:,1); 
    Cb = YCbCr(:,:,2); 
    Cr = YCbCr(:,:,3); 
    [height,width] = size(Y); 
    for q=1:32:height-32 
     for w= 1:32:width-32 
      block = Y(q:q+63 , w:w+63); 
       Resultados='C:\Users\LG\Desktop\TIFF\training\60'; %save image path 
       imwrite(block, fullfile(Resultados, ['SerieN', num2str(i), '.jpg']),'Quality',60) % save image 
       name = name+1; 
     end 
    end 
end 

Antwort

1

Das Feld dList(i).name nicht den vollständigen Pfad enthält, nur die Dateinamen. Sie können den vollständigen Pfad unter Verwendung von fullfile:

dList(i).data = imread(fullfile(imgPath, dList(i).name)); 
abrufen