I can't load the lighthouse.mat image

4 visualizaciones (últimos 30 días)
Richard
Richard el 12 de Oct. de 2024
Editada: DGM el 13 de Oct. de 2024
% Load the lighthouse image
load('lighthouse.mat');
% Display the original image
figure;
imshow(ww);
title('Original Lighthouse Image');
%Down-sample the image by factor of 2
p=2;
wp=ww(1:p:end, 1:p:end);
% Display the downsampled image
figure;
imshow(wp);
title(['Downsampled Image by a Factor of', num2str(p)])
error:
Error using load
Unable to find file or directory 'lighthouse.mat'.
Error in untitled5 (line 2)
load('lighthouse.mat');

Respuestas (2)

Venkat Siddarth Reddy
Venkat Siddarth Reddy el 12 de Oct. de 2024
Hi Richard,
It seems that the MATLAB is unable to find the "lighthouse" MAT file in its search path.
To resolve this issue, please make sure, either the file is in the current working directory or the file location is added to the MATLAB search path.
To learn more about adding a file location to MATLAB search path, please refer to the following documentation:
I hope it helps!

DGM
DGM el 13 de Oct. de 2024
Editada: DGM el 13 de Oct. de 2024
I found this one (attached), but I can't be sure if it's the right one. I have to wonder, since it seems that you're expecting the file to contain a variable "ww", whereas Walter's thread expects the file to contain a variable "lighthouse". This one contains an array called "xx".
load lighthouse.mat
imshow(xx)
EDIT: This particular mat-file was saved in 2002 and appears to contain the same image (i.e. same photo content and array size/class) as some of the assignment summaries I've seen. I'm pretty sure this is a standard image, as I've seen it around. Even if there are mat-files with different variable names, this is probably equivalent.
Otherwise, you're probably supposed to download the file from somewhere associated with the book or online resource you're using.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by