www.gusucode.com > 《matlab图像处理与界面编程宝典》秦襄培 编著,每章的MATLAB源代码程序 > 第12章/代码12-21.txt

    
I=imread('sample2.jpg');
BW = im2bw(I);
colormap(gray);
image(BW);
运行结果图像显示为全黑。正确的显示程序为:
I=imread('sample2.jpg');
BW = im2bw(I);
colormap(gray);
imshow(BW);