MATLAB: Hi all, I am getting error as follows Error in imread (line 340) fullname = get_full_f​ilename(fi​lename); Error in cv (line 4) k = imread(‘Earth.jpg’); Can somebody please help me on this

MATLAB

clc;
clear;
close all;
k = imread('Earth.jpg');
k=rgb2gray(k);
k = imresize(k,.5); %makes image 1/2 size
k=imrotate(k,45); %rotates image 45 degrees
s=size(k,1);p=zeros(s,s);
for x=1:s
for y=1:s[t,r]=cart2pol(x,y);
t=round(t);
r=round(log(r));
if t==0
t=1;
end
if t>s
t=s;
end
if r==0
r=1;
end
if r>s
r=s;
end
r=r+35;
p(t,r+i)=k(x,y);
end
end
p=uint8(p); %converts datatype
p = imresize(p,2.5); %makes final image larger for output
imshow(p)

Best Answer

The most common cause of that message is that 'Earth.jpg' does not exist in the current directory or in any directory along the MATLAB path.