clear; clc close all; disp('====E2_4_2.m===='); I=imread('PIC2.4.3a-RGB24b.bmp'); imfinfo('PIC2.4.3a-RGB24b.bmp') I2=im2bw(I); % 语句1 imwrite(I2,'PIC2.4.3b-GRAY.bmp'); imfinfo('PIC2.4.3b-GRAY.bmp') figure,subplot(1,2,1),imshow(I); subplot(1,2,2),imshow(I2);