Getting error using imread

303 views (last 30 days)
oshawcole on 2 Aug 2018
Commented: Image Analyst on 3 Aug 2022 at 0:26
I am trying to read an image and this is the error I am getting this error. Please help.
Error using fopen The file name contains characters that are not contained in the filesystem encoding. Certain operations may not work as expected.
Error in imread>get_full_filename (line 504) [fid, errmsg] = fopen(filename, 'r');
Error in imread (line 340) fullname = get_full_filename(filename);

Accepted Answer

Image Analyst
Image Analyst on 2 Aug 2018
Unfortunately you forgot to attach 'C:\Users\shrup\Downloads\spec.jpg', so about all I can say is that the filename is corrupted somehow. It must have hidden/special characters in it like the error message says.
Image Analyst
Image Analyst on 7 Sep 2020
Reply to this command and attach your image with the paper clip icon.

Sign in to comment.

More Answers (4)

Image Analyst
Image Analyst on 23 Dec 2018
Felix, I think the error
File "C:\Users\Administrator\Documents\DistortedImages\t1.bmp" does not exist.
is pretty clear. Why do you think it does exist? Can you show us (upload) a screenshot of that file in File Explorer with the folder, and the file both shown?
If you want you can use exist(filename, 'file') to see if the file exists, and skip it if it doesn't exist. Or use imagesDataStore(). Or you can Use the FAQ to run code that gets ONLY files that exist and not ones that don't exist.
cathrine Mutafya
cathrine Mutafya on 2 Aug 2022 at 18:29
this is the error am having
close all
% provide the data path where the training images are present
% if your matlab environment doesn't support 'uigetdir' function
% change those lines in code for datapath and testpath as :
% datapath = 'give here the path of your training images';
% testpath = 'similarly give the path for test images';
datapath = uigetdir('C:\Users\USER\Desktop\project','C:\Users\USER\Desktop\project\New folder\traingset');
Error using matlab.internal.lang.capability.Capability.require
Support for Java user interfaces is required, which is not available on this platform.

Error in uigetdir (line 52)
testpath = uigetdir('C:\Users\USER\Desktop\project\New folder','C:\Users\USER\Desktop\project\New folder\test images');
prompt = {'test images(1):'};
dlg_title = 'Input of PCA-Based Face Recognition System';
num_lines= 1;
def = {''};
TestImage = inputdlg(prompt,dlg_title,num_lines,def);
TestImage = strcat(testpath,'\',char(TestImage),'.jpg');
% calling the function
recog_img = facerecog(datapath,TestImage);
selected_img = strcat(datapath,'\',recog_img);
select_img = imread(selected_img);
title('Recognized Image');
test_img = imread(TestImage);
title('Test Image');
result = strcat('the recognized image is : ',recog_img);

Sign in to comment.

Felix Ajayi
Felix Ajayi on 23 Dec 2018
Edited: Image Analyst on 23 Dec 2018
Hello Image Analyst, I have issues with sytax below
for i=1:980
I = imread(['C:\Users\Administrator\Documents\DistortedImages\t',i1,'.bmp']);
Command Window
Error using imread
File "C:\Users\Administrator\Documents\DistortedImages\t1.bmp" does not exist.
It is observed that each image of the 980 distorted images is saved as t(1), t(2), t(3) and so on till it reaches the last image with t(980) all distorted images with different distortion types and levels.
Also, what is the syntax code using referenece image of about 20 images and corresponding distorted images which is about 980 images. with every reference image compared and obtain an output score with respect to the respective 49 distorted images
first reference image to 49 distorted images
second reference image to 49 distorted images
and so on until it reaches the 20th reference image and corresponding distorted image.
All the distorted images are in the database are saved as t(1), t(2) and on till it reaches t(980).
Thank you in advance.
  1 Comment
Felix Ajayi
Felix Ajayi on 23 Dec 2018
Please Experts in the House , the above is a problem not an answer.
Thank you.

Sign in to comment.

Felix Ajayi
Felix Ajayi on 24 Dec 2018
Hello Image Analyst,
Thank you for the prompt feedback.
I just uploaded the screenshot of the file in file explorer with the folder, and the images shown both reference images and distorted imagest() . In the distorted images folder there are 980 images numbered in bracket that is t(1),t(2), and so on till it reaches t(980).
Hope to read from you soon.
Thank you.
Image Analyst
Image Analyst on 3 Aug 2022 at 0:26
@cathrine Mutafya, please start your own question for this. Your question might not get found buried deep here in this already-solved, four year old question.

Sign in to comment.

JAMAL CHAFI on 15 Dec 2019
imread: unable to find file 0+1i.jpeg
called from
imageIO at line 71 column 7
imread at line 106 column 30
TP_ISM at line 12 column 3
  1 Comment
Image Analyst
Image Analyst on 15 Dec 2019
Yes, so? You simply do not have an image file on disk with that particular filename. Are you sure that is the name? It looks very unusual to have a complex number be the file name.
Do you think you should have that file? Are you using fullfile() to construct the full file name, or are you expecting the image file to be in the same folder as your m-file, or at least on the search path.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!