資源描述:
《數(shù)字圖像處理實驗作業(yè)及代碼》由會員上傳分享,免費在線閱讀,更多相關內(nèi)容在工程資料-天天文庫。
1、數(shù)字圖像處理一實驗一源程序: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('變換函數(shù)一');axison;figure,imshow(a2),title('改后二');axison;figure,imhist(a2),title('改后直方圖二');axison;figure,plot(r,s2),title('變換函數(shù)二');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('變換函數(shù)一');axison;figure,imshow(b2),title('改后二');axison;figure,imhist(b2),title('改后直方圖二');axison;figure,plot(r,s2),title('變換函數(shù)二');axison;figure,imshow(b3),title('改后二');axison;figure,imhist(b3),title('改后直方圖三');axison;figure,plot(r,s3),title('變換函數(shù)三'
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('變換函數(shù)');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(,變換函數(shù)');axison;imwrite(d,第二次改后rice.jpg');e=imread(,Picture.jpg,);e