Warning: IMSHOW(I,N) is an obsolete syntax. Your grayscale image will be displayed using 256 shades of gray

105 views Asked by At

I get this warning:Warning: IMSHOW(I,N) is an obsolete syntax. Your grayscale image will be displayed using 256 shades of gray..please help me. Ihave implemented 2d dct.why its not working for m=64;

m=input('enter the basis matrix dimension:');
n=m;
alpha2=ones(1,n)*sqrt(2/n);
alpha2(1)=sqrt(1/n);
alpha1=ones(1,m)*sqrt(2/m);
alpha1(1)=sqrt(1/m);
for u=0:m-1
    for v=0:n-1
        for x=0:m-1
            for y=0:n-1
                a(u+1,v+1,x+1,y+1)=alpha1(u+1)*alpha2(v+1)*cos((2*x+1)*u*pi/(2*n))*cos((2*y+1)*v*pi/(2*n));
            end
        end
    end
end
mag=a;
figure;
k=1;
%code to plot basis
for i=1;m
    for j=1:n
        subplot(m,n,k)
        imshow(mag(i,j),256);
        k=k+1;
    end
end
1

There are 1 answers

2
user1543042 On BEST ANSWER

You can't subindex like that, try:

a(u+1,v+1, x+1,y+1)=alpha1(u+1)*alpha2(v+1)*cos((2*x+1)*u*pi/(2*n))*cos((2*y+1)*v*pi/(2*n))

Edit:

You had 3 problems. You were still trying to pull data out as if it were a submatrix, then fixing that the dimensions weren't correct, and the error you commented on.

This is to fix all of them.

imshow(squeeze(mag(i,j,:,:)),[0, 255]);