I am been trying and getting the error even though the file name is same

6 views (last 30 days)
% Clear workspace and command window
clear all;
clc;
close all;
% Read images with different exposure times
I1 = imread('scene1.png');
I2 = imread('scene2.png');
I3 = imread('scene3.png');
% Convert images to double precision
I1 = double(I1);
I2 = double(I2);
I3 = double(I3);
% Combine images to create HDR image
HDR = I1 + I2 + I3;
% Normalize the HDR image to the range [0, 255]
HDR_normalized = uint8(255 * mat2gray(HDR));
% Display the normalized HDR image
imshow(HDR_normalized);
title('Normalized HDR Image');
Error using imread>get_full_filename
File "scene1.png" does not exist.
Error in imread (line 372)
fullname = get_full_filename(filename);
Error in untitled (line 11)
I1 = imread('scene1.png'); % Update the filename and extension if necessary
  2 Comments
Matt J
Matt J on 23 Oct 2024
Edited: Matt J on 23 Oct 2024
We can only help troubleshoot errors related to your code, not your environment. You have clearly put scene1.png somewhere that Matlab cannot see it.
Walter Roberson
Walter Roberson on 23 Oct 2024
Or possibly scene1 exists but has a different file extension such as scene1.jpg

Sign in to comment.

Answers (1)

Jayanti
Jayanti on 23 Oct 2024
Hi Omeir,
The error message suggest that MATLAB is unable to find the file “scene1.png” in the current directory. This can happen if the file is not located where MATLAB is currently looking.
To list files with a specific extension, such as “.png”, you can use the “dir” function. You can see the list of pngfiles present by typing the below code in the MATLAB command window.
pngFiles = dir('*.png');
for i = 1:length(pngFiles)
disp(pngFiles(i).name);
end
If the needed “png” is not listed, you can follow any one of the below steps:
  1. Consider moving "scene1.png" and all other files to the current working directory where your MATLAB script is running.
  2. Specify the full path to the file in your code.
I1 = imread('full_path_to_your_images\scene1.png');
3. You can add the directory where “scene1.png” is located to the MATLAB path.
addpath('full_path_to_your_images\scene1.png');
Hope this will resolve your query!

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!