MATLAB: How Can I Solve the imread Error

image processingMATLAB

I am currently working on a project of flower identification by using RGB color extraction, but I get some errors when I want to read the image files. It said :
Error using imread>get_full_filename (line 516)
File "Image_Folder\Image_Files(n).name" does not exist.
Error in imread (line 340)
fullname = get_full_filename(filename);
Error in Latih (line 8)
Img = imread(fullname);
How can I solve this? Here is my code:
Image_Folder = 'D:\TUGAS KULIAH\PEMODELAN KECERDASAN BUATAN\Tugas Pengganti UAS\Data Latih';
Image_Files = fullfile(Image_Folder,'*.jpeg');
Total_Images = numel(Image_Files);
Training_Data = zeros(3,Total_Images);
for n = 1:Total_Images
fullname= fullfile('Image_Folder', 'Image_Files(n).name');
Img = imread(fullname);
Img = im2double(Img);
% RGB Color Extraction
R = Img(:,:,1);
G = Img(:,:,2);
B = Img(:,:,3);
CharR = mean2(R);
CharG = mean2(G);
CharB = mean2(B);
Training_Data(1,n) = CharR;
Training_Data(2,n) = CharG;
Training_Data(3,n) = CharB;
end

Best Answer

  • Image_Files = dir( fullfile(Image_Folder,'*.jpeg') );
    and
    fullname= fullfile(Image_Folder, Image_Files(n).name);