I am been trying and getting the error even though the file name is same
2 ビュー (過去 30 日間)
古いコメントを表示
% 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 件のコメント
Walter Roberson
2024 年 10 月 23 日
Or possibly scene1 exists but has a different file extension such as scene1.jpg
回答 (1 件)
Jayanti
2024 年 10 月 23 日
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 “png” files 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:
- Consider moving "scene1.png" and all other files to the current working directory where your MATLAB script is running.
- 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!
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!