日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

DIP第十章习题解答

發布時間:2025/4/16 编程问答 12 豆豆
生活随笔 收集整理的這篇文章主要介紹了 DIP第十章习题解答 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

數字圖像處理 第十章課后作業

文檔地址:數字圖像處理第十章課后作業.pdf_數字圖像處理第10章答案,數字圖像處理第十章課后答案-圖像處理文檔類資源-CSDN下載https://download.csdn.net/download/qq_44143405/12549552

第一題

10-2 設有一幅包含有水平直線、垂直直線、 方向直線和 -方向直線的二值圖像。給出一組大小為 5×5 的模板,要求這些模板可用于檢測這些直線中的1像素間斷。假設直線和背景的灰度分別是1和0。

答:掩模將具有圖所示的系數。當每個遮罩以在該遮罩所偏向的方向上定向的連續?5?像素段的像素為中心時,每個遮罩將產生?0?值。相反,當一個掩模位于?5?像素段中的一個像素間隙上時,響應為?+4?,該?5?像素段的方向是該掩模所偏向的方向。

0

0

0

0

0

0

0

1

0

0

0

0

0

0

0

0

0

1

0

0

1

1

-4

1

1

0

0

-4

0

0

0

0

0

0

0

0

0

1

0

0

0

0

0

0

0

0

0

1

0

0

水平直線掩模模塊? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 垂直直線掩模模塊

0

0

0

0

1

1

0

0

0

0

0

0

0

1

0

0

1

0

0

0

0

0

-4

0

0

0

0

-4

0

0

0

1

0

0

0

0

0

0

1

0

1

0

0

0

0

0

0

0

0

1

45度直線掩模模塊? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?-45度直線掩模模塊

第二題

10-29 使用10.3.2節的基本全局閾值處理算法得到的閾值與起始點無關嗎?如果您的回答是“是”,證明它,如果回答是“不”,給出一個例子。

附:

第一題代碼塊

Image=imread('pattern.jpg');Th=graythresh(Image);OriginBW=im2bw(Image,Th);BW1=1-OriginBW;se=strel('square',5);%結構元素為邊長為5的正方形BW2=1-imopen(BW1,se);se45=strel('line',25,45);%結構元素為角度為45的線,長度為25個像素BW3=1-imopen(BW1,se45);se_45=strel('line',25,-45);%結構元素為角度為45的線,長度為25個像素BW4=1-imopen(BW1,se_45);figure;subplot(221),imshow(OriginBW);title('原始二值圖像');subplot(222);imshow(BW2);title('矩形塊提取');subplot(223);imshow(BW3);title('45線段提取');subplot(224);imshow(BW4);title('-45線段提取');se0=strel('line',5,0);%結構元素為水平線,長度為25個像素BW5=1-imopen(BW1,se0);se90=strel('line',5,90);%結構元素為垂直的線,長度為25個像素BW6=1-imopen(BW1,se90);figure;subplot(131),imshow(OriginBW);title('原始二值圖像');subplot(132),imshow(BW5);title('水平線段提取');subplot(133);imshow(BW6);title('垂直線段提取');

第二題代碼塊

clear,clc,close all;Image=rgb2gray(imread('lotus1.jpg'));figure,imshow(Image),title('原始圖像');imhist(Image);hist1=imhist(Image);hist2=hist1;iter=0;while?1[is,peak]=Bimodal(hist1);if?is==0hist2(1)=(hist1(1)*2+hist1(2))/3;for?j=2:255hist2(j)=(hist1(j-1)+hist1(j)+hist1(j+1))/3;endhist2(256)=(hist1(255)+hist1(256)*2)/3;hist1=hist2;iter=iter+1;if?iter>1000break;endelsebreak;endend[trough,pos]=min(hist1(peak(1):peak(2)));thresh=pos+peak(1);figure,stem(1:256,hist1,'Marker','none');hold onstem([thresh,thresh],[0,trough],'Linewidth',2);hold offresult=zeros(size(Image));result(Image>thresh)=1;figure,imshow(result),title('基于雙峰直方圖的閾值化');imwrite(result,'bilotus1.jpg'); ?Image=rgb2gray(imread('lotus1.jpg'));figure,imshow(Image),title('原始圖像');T=graythresh(Image);result1=im2bw(Image,T);figure,imshow(result1),title('OTSU方法二值化圖像 ');figure,subplot(221),imshow(Image),title('原始圖像');subplot(222),imhist(Image);subplot(223),imshow(result),title('基于雙峰直方圖的閾值化');subplot(224),imshow(result1),title('OTSU方法二值化圖像 ');function?[is,peak]=Bimodal(histgram)count=0;for?j=2:255if?histgram(j-1)<histgram(j) && histgram(j+1)<histgram(j)count=count+1;peak(count)=j;if?count>2is=0;return;endendendif?count==2is=1;elseis=0;endend

總結

以上是生活随笔為你收集整理的DIP第十章习题解答的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。