Rectify the error in imread

조회 수: 68 (최근 30일)
varsha reddy
varsha reddy 2018년 7월 8일
댓글: Ataslina 2022년 6월 15일
Whenever i try to execute this command: a=imread('itsarose.jpg'); It shows an error: Error using imread>get_full_filename (line 516) File "itsarose.jpg" does not exist.
Error in imread (line 340) fullname = get_full_filename(filename);
i just followed it with an imshow command , nothing much.I use MatlabR2018a. What can i do to rectify this?
  댓글 수: 4
shital shinde
shital shinde 2019년 8월 25일
eventhough I go for .jpg extenction, I got the same error. please give me the suggestion
Walter Roberson
Walter Roberson 2019년 8월 25일
shital shinde, at the time you execute the imread(), which directory are you cd() to? What is the name you are passing to imread() ? What is the full path of where the file is actually stored?
Do you happen to be using dir() to find files that are underneath a subfolder? If so then when you are constructing the file name you might be forgetting to include the name of the subfolder.

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

답변 (3개)

Star Strider
Star Strider 2018년 7월 8일
Your 'itsarose.jpg' image has to be in the MATLAB search path for imread to find it. If it is not, you have to provide the full path to it in the file name.

Jan
Jan 2018년 7월 8일
편집: Jan 2018년 7월 9일
Do not work with relative paths and it is a bad idea to add folders to the path, because it can confuse Matlab substantially, if the added folders contain M-files. Prefer to use absolute paths instead. In which folder is the image file found?
Folder = 'C:\Temp';
a = imread(fullfile(Folder, 'itsarose.jpg'))
  댓글 수: 2
Walter Roberson
Walter Roberson 2018년 7월 8일
get_full_filename is an internal function of imread()
Jan
Jan 2018년 7월 9일
편집: Jan 2018년 7월 9일
@Walter: Thanks. I've removed the corresponding part from my answer.

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


Muhammad Usama Sharaf SAAFI
Muhammad Usama Sharaf SAAFI 2020년 1월 24일
Your image file must me in MATLAB serach path. You should keep your image file in current folder. If you are confused you should give full file name like this
dir = 'C:\Temp\Users'; %give directory of image
image_read = imread(fullfile(dir, 'image_name.jpg'));
  댓글 수: 1
Ataslina
Ataslina 2022년 6월 15일
Thank you very much!

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

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by