Where to store images on computer for imread

12 views (last 30 days)
I am trying to open images using the imread function however whenever I do, I get this error
I = imread('D Red bball')
Error using imread>get_full_filename
File "D Red bball" does not exist.

Error in imread (line 372)
fullname = get_full_filename(filename);
Is this because the image is not stored in the right place on my computer or is it due to another issue? What is in the single commas is the name of the image that is in files.
  1 Comment
Dyuman Joshi
Dyuman Joshi on 8 Feb 2024
Edited: Dyuman Joshi on 8 Feb 2024
You can only read 1 file at a time via imread. If you want to read more than 1 images at a time, consider using imageDatastore.
And you have to provide the extension of the image as well in the filename.
Make sure you have provided the right path where the images are to MATLAB.
Either use fullfile and provide the full file location of the images, or ensure the image(s) to be read are in the current directory.

Sign in to comment.

Accepted Answer

Stephen23
Stephen23 on 8 Feb 2024
Edited: Stephen23 on 8 Feb 2024
"Is this because the image is not stored in the right place on my computer.."
The only "right place" is the location where you tell IMREAD where the files are.
"...or is it due to another issue?"
Most likely you did not tell IMREAD where the file is located OR the filename is wrong:
P = 'C:\Users\SomeUser\Pictures\Folder'; % absolute or relative path to where the files are
F = 'D Red bball.jpg'; % name of a file that exists on that path
I = imread(fullfile(P,F))
Do NOT pollute your MATLAB search path with folders of data, i.e. avoid ADDPATH or similar just to read a data file.

More Answers (0)

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!