Apparently the image should be given by .jpeg and not .jpg ,and it worked. Thanks for the suggestions.
Rectify the error in imread
36 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
shital shinde
el 25 de Ag. de 2019
eventhough I go for .jpg extenction, I got the same error. please give me the suggestion
Walter Roberson
el 25 de Ag. de 2019
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.
Respuestas (3)
Star Strider
el 8 de Jul. de 2018
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.
See What Is the MATLAB Search Path? (link) and Add Folders to the MATLAB Search Path at Startup (link) and related documentation.
0 comentarios
Jan
el 8 de Jul. de 2018
Editada: Jan
el 9 de Jul. de 2018
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 comentarios
Muhammad Usama Sharaf SAAFI
el 24 de En. de 2020
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'));
Ver también
Categorías
Más información sobre Search Path en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!