写函数,函数名与文件名同名
调用函数新建个文件。
imag=imread('C:\Users\liulang\Desktop\test.jpg') gray=rgb2gray(imag) log=intrans(gray,'log',1) neg=intrans(gray,'neg') stretch=intrans(gray,'stretch',1,2) gam5=intrans(gray,'gamma',5) gam1=intrans(gray,'gamma',1) stretch15=intrans(gray,'stretch',1,5) stretch105=intrans(gray,'stretch',1,0.5) stretch51=intrans(gray,'stretch',5,1) stretch55=intrans(gray,'stretch',5,5) figure(1),subplot(331),imshow(ori); subplot(332),imshow(neg);title('反转') subplot(333),imshow(log);title('log,c=1') subplot(334),imshow(stretch);title('对比度拉伸m=1,e=2') subplot(335),imshow(gam5);title('gamma=5') subplot(336),imshow(gam1);title('gamma=1') subplot(337),imshow(stretch15);title('m=1,e=5') subplot(338),imshow(stretch105);title('m=1,e=0.5') subplot(339),imshow(stretch51);title('m=5,e=1') subplot(339),imshow(stretch55);title('m=5,e=5')