该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
rice=imread('rice.png');
[m,n]=size(rice);
I2=double(rice); %变换矩阵中的每个元素
for i=1:m
for j=1:n
for k=0:7
f=I2(i,j);
g(i,j)(k)=0;
if (f>=0)&&(f<=2^k)
g(i,j)(k)=0;
elseif(f>=2^k)&&(f<=(2^8-1))
g(i,j)(k)=1;
end
end
end
end
subplot(2,5,1);subimage(rice);title('(1) original image')
subplot(2,5,2);subimage(mat2gray(g(0)));title('(2) 0 bitmap image')
subplot(2,5,3);subimage(mat2gray(g(1)));title('(3) 1 bitmap image')
subplot(2,5,4);subimage(mat2gray(g(2)));title('(4) 2 bitmap image')
subplot(2,5,5);subimage(mat2gray(g(3)));title('(5) 3 bitmap image')
subplot(2,5,6);subimage(mat2gray(g(4)));title('(6) 4 bitmap image')
subplot(2,5,7);subimage(mat2gray(g(5)));title('(7) 5 bitmap image')
subplot(2,5,8);subimage(mat2gray(g(6)));title('(8) 6 bitmap image')
subplot(2,5,9);subimage(mat2gray(g(7)));title('(9) 7 bitmap image')
结果显示??? Error: File: bitmap.m Line: 9 Column: 9
()-indexing must appear last in an index expression.
请问应该怎样修改,非常谢谢!