资源描述:
《数字图像处理实验作业及代码》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、数字图像处理一实验一源程序:a=imread('rice.png');figure,imshow(a),title('原图');axison;a=double(a)/256;figure,imhist(a),title('原直方图');axison;r=[0:0.001:1];s1=[r<0.35].*r*0.3+[r<=0.65].*[r>=0.35].*(0.105+2.6333*(r-0.35))+[r>0.65].*(1+0.3*(r-1));s2=[r<=0.5].*(r.A5)*15.9744+[
2、r>0.5].*((r-0.5).A0.2+0.12);a1=[a<0.35].*a*0.3+[a<=0.65].*[a>=0.35].*(0.105+2.6333*(a-0.35))+[a>0.65].*(1+0.3*(a-1));a2=[a<=0.5].*(a.A5)*15.9744+[a>0.5].*((a-0.5).A0.2+0.12);figure,imshow(a1),title('改后一');axison;figure,imhist(a1),title('改后直方图一');axison;figu
3、re,plot(r,s1),title('变换函数一');axison;figure,imshow(a2),title('改后二');axison;figure,imhist(a2),title('改后直方图二');axison;figure,plot(r,s2),title('变换函数二');axison;imwrite(a1,'改后rice—.jpg');imwrite(a2,'改后rice二.jpg');b=imread('kids.tif);figure,imshow(b),title('原图');a
4、xison;b=double(b)/256;figure,imhist(b);title('原直方图');axison;s1=r.A0.6;s2=r.A0.4;s3=r.A0.3;b1=imadjust(b,[],[],0.6);b2=imadjust(b,[],[],0.4);b3=imadjust(b,[],[],0.3);figure,imshow(b1),title('改后——');axison;figure,imhist(b1),title('改后直方图一');axison;figure,plot(
5、r,s1),title('变换函数一');axison;figure,imshow(b2),title('改后二');axison;figure,imhist(b2),title('改后直方图二');axison;figure,plot(r,s2),title('变换函数二');axison;figure,imshow(b3),title('改后二');axison;figure,imhist(b3),title('改后直方图三');axison;figure,plot(r,s3),title('变换函数三'
6、);axison;imwrite(b1,'改后kids一.jpg');imwrite(b2,改后kids二.jpg');imwrite(b3,'改后kids三.jpg');c=imread(,circuit.tif);figure,imshow(c),title(,M图');axison;c=double(c)/256;figure,imhist(c),title('原直方图');axison;s=1-r;c=1-c;figure,imshow(c),title(,变换后');axison;figure,im
7、hist(c),title('变换后直方图');axison;figure,plot(r,s),title('变换函数');axison;imwrite(c,改后circuit.jpg1);d=imread(,rice.png,);figure,imshow(d),title('原图');axison;d=double(d)/256;figure,imhist(d),title('原直方图');axison;r=[0:0.001:1];s=[r<=0.4].*[r>=0.2]*0.6;d=[d<=0.4].*
8、[d>=0.2]*0.6+[d>0.4].*d+[d<0.2].*d;figure,imshow(d),title(,变换后');axison;figure,imhist(d),title('变换后直方图');axison;figure,plot(r,s),title(,变换函数');axison;imwrite(d,第二次改后rice.jpg');e=imread(,Picture.jpg,);e