[F,P]=uigetfile('*.pgm;*.jpg;*.jpeg;*.tif;*.tiff;*.bmp;*.png;*.hdf;*.pcx;*.xwd','选择图像');
imna=strcat(P,F);
myi=imread(imna);
figure(1);
imshow(myi);
figure(2);
image(myi);
bgray=rgb2gray(myi);
figure(3);
imshow(bgray);
imwrite(bgray,'th.bmp','bmp');