Getting error using imread

조회 수: 232 (최근 30일)
oshawcole
oshawcole 2018년 8월 2일
댓글: Image Analyst 2023년 4월 9일
a=imread('C:\Users\shrup\Downloads\spec.jpg');
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);
  댓글 수: 2
Rudrani
Rudrani 2023년 2월 4일
i am also facing this type of problem please help me
Walter Roberson
Walter Roberson 2023년 2월 4일
You are using MATLAB Online but you are trying to read files from your C drive. MATLAB Online does not have the ability to read files from your local disk (except the upload feature)
MATLAB Online is being accessed through a browser, and browsers do not have the ability to read files except through a dedicated upload facility. This is for security reasons: no-one should be able to write a web page that reads files on your disk without you knowing

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2018년 8월 2일
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.
  댓글 수: 10
Ahmad Bilal
Ahmad Bilal 2023년 4월 9일
how did you resove it?
Image Analyst
Image Analyst 2023년 4월 9일
@Ahmad Bilal undoubtedly he corrected the filename string and passed it a string corresponding to a file that actually exists, not to one that does not exist.

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Image Analyst
Image Analyst 2018년 12월 23일
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.
  댓글 수: 5
Walter Roberson
Walter Roberson 2023년 1월 2일
use fullfile() instead of building directory paths by hand
Image Analyst
Image Analyst 2023년 1월 2일
Instead of uigetdir and inputdlg, let the user either pick the filename out of a listbox of all the filenames (best), or have them pick each image with uigetfile:
% Have user browse for a file, from a specified "starting folder."
% For convenience in browsing, set a starting folder from which to browse.
startingFolder = pwd; % or 'C:\wherever';
if ~isfolder(startingFolder)
% If that folder doesn't exist, just start in the current folder.
startingFolder = pwd;
end
% Get the name of the file that the user wants to use.
defaultFileName = fullfile(startingFolder, '*.*');
[baseFileName, folder] = uigetfile(defaultFileName, 'Select a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName)
TestImage = fullFileName; % Bad name - it's not an image it's a character string.

댓글을 달려면 로그인하십시오.


Felix Ajayi
Felix Ajayi 2018년 12월 23일
편집: Image Analyst 2018년 12월 23일
Hello Image Analyst, I have issues with sytax below
for i=1:980
i1=num2str(i);
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.
  댓글 수: 4
Felix Ajayi
Felix Ajayi 2018년 12월 25일
편집: DGM 2023년 2월 13일
The Image Analyst,
Let me use this opportunity again to thank you for your gesture.
Please I have reference and distorted images of different quanity that is not equal quantity in numbers.
Number of reference images is 20
Number of distorted is 980
The first reference image already have 49 distorted images (different distrotion types and levels)
Now, am to input each pair into a local binary(similarity) to get a score that is one reference multiply by 49 distortions to get 49 score on a row. This is applicable to the all 20 reference images x 980 distrotions = 980 scores to have 49 rows and 20 columns.
Attached is a screenshot. Please I will appreciate function of code to achieve this.
Thank you!
Image Analyst
Image Analyst 2018년 12월 25일
이동: DGM 2023년 2월 13일
This is a project. Not something I can bang out in 5 minutes, or even an hour. If you can't do it yourself, then you can hire a consultant to do it for you. Try fiverr.com or The MathWorks Consulting Best wishes.

댓글을 달려면 로그인하십시오.


JAMAL CHAFI
JAMAL CHAFI 2019년 12월 15일
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
Image Analyst
Image Analyst 2019년 12월 15일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by