|
數(shù)字圖像處理Matlab實(shí)驗(yàn)——儀器表盤(pán)識(shí)別
1. 實(shí)驗(yàn)背景
指針式機(jī)械表盤(pán)具有安裝維護(hù)方便、結(jié)構(gòu)簡(jiǎn)單、防電磁干擾等諸多優(yōu)點(diǎn), 目前廣泛應(yīng)用于工礦企業(yè)、能源及計(jì)量等部門(mén)。隨著儀表數(shù)量的增加及精密儀表技術(shù)的發(fā)展,人工判讀已經(jīng)不能滿足實(shí)際應(yīng)用需求。隨著計(jì)算機(jī)技術(shù)和圖像處理技術(shù)的不斷發(fā)展,指針式機(jī)械表自動(dòng)讀表技術(shù)應(yīng)運(yùn)而生。該技術(shù)提高了表盤(pán)識(shí)別的自動(dòng)化程度及實(shí)時(shí)性,將代替?zhèn)鹘y(tǒng)工業(yè)儀表的讀取方式得到廣泛應(yīng)用。
2. 實(shí)驗(yàn)?zāi)康?br />
(1)了解機(jī)械式表盤(pán)自動(dòng)讀表技術(shù)的基本原理。
(2)了解儀器表盤(pán)識(shí)別技術(shù)的基本方法和相關(guān)算法。
(3)學(xué)會(huì)利用MATLAB實(shí)現(xiàn)對(duì)圖像的邊緣檢測(cè)、圖像邊緣銳化、二值化處理、Hough變換等圖像處理技術(shù)。
3. 實(shí)驗(yàn)原理
根據(jù)機(jī)械式表盤(pán)的圖像特征,采用圖像邊緣點(diǎn)法線方向計(jì)數(shù)累加的圓心定位方法及過(guò)定點(diǎn)的直線檢測(cè)算法,達(dá)到表盤(pán)識(shí)別的目標(biāo)。儀表刻度檢測(cè)流程如下: 攝像頭采集表盤(pán)圖像,送入計(jì)算機(jī)進(jìn)行預(yù)處理及邊緣檢測(cè)操作;計(jì)算機(jī)檢測(cè)出表盤(pán)回轉(zhuǎn)中心及半徑,并定位出表盤(pán)的有效顯示區(qū)域;在此區(qū)域內(nèi),利用過(guò)定點(diǎn)( 回轉(zhuǎn)中心)的Hough 直線變換,基于特征點(diǎn)對(duì)應(yīng)角度的峰值搜索算法識(shí)別出指針中心線,從而輸出檢測(cè)結(jié)果。
參考資料:
《數(shù)字圖像處理》(第三版) 岡薩雷斯 電子工業(yè)出版社
《數(shù)字圖像處理的MATLAB實(shí)現(xiàn)》(第二版) 岡薩雷斯 清華大學(xué)出版社
《MATLAB數(shù)字圖像處理》(第二版) 張德豐 機(jī)械工業(yè)出版社
參考文獻(xiàn):陳繼華, 李勇, 田增國(guó), & 李磊. (2015). 基于機(jī)器視覺(jué)的機(jī)械式表盤(pán)自動(dòng)讀表技術(shù)的實(shí)現(xiàn). 鄭州大學(xué)學(xué)報(bào)(工學(xué)版), 36(3), 101-105.
4. 實(shí)驗(yàn)要求
(1)自選一副儀表圖片。讀入圖像,對(duì)圖像進(jìn)行預(yù)處理及邊緣檢測(cè)操作。
(2)采用平滑濾波法對(duì)圖像進(jìn)行處理,濾波的同時(shí)銳化圖像的邊緣。
(3)通過(guò)對(duì)讀入的儀表圖像進(jìn)行處理,能清楚的識(shí)別表盤(pán)指針指數(shù),且具有較準(zhǔn)確的識(shí)別精度。
5.實(shí)驗(yàn)報(bào)告要求
描述實(shí)驗(yàn)的基本步驟,用數(shù)據(jù)和圖片給出各個(gè)步驟中取得的實(shí)驗(yàn)結(jié)果,并進(jìn)行必要的討論,必須包括原始圖像及其計(jì)算/處理后的圖像。
7. 實(shí)驗(yàn)程序
RGB=imread('14.jpg');
figure,imshow(RGB); title('RGB')
GRAY=rgb2gray(RGB);
figure,imshow(GRAY); title('GRAY')
threshold=graythresh(GRAY);
BW=im2bw(GRAY,threshold);
figure,imshow(BW); title('BW')
BW=~BW;
figure,imshow(BW); title('~BW')
BW=bwmorph(BW,'thin',Inf);
figure,imshow(BW); title('BWMORPH')
[M,N]=size(BW);
[H,T,R] = hough(BW);
figure;
imshow(H,[],'XData',T,'YData',R,'InitialMagnification','fit');
xlabel('\theta'), ylabel('\rho');
axis on, axis normal, hold on;
P = houghpeaks(H,1,'threshold',ceil(0.3*max(H(:))));
x = T(P(:,2));
y = R(P(:,1));
plot(x,y,'s','color','white');
%%%%%%%%%%%%%%%%%%%% Find lines and plot them%%%%%%%%%%%%%%
lines = houghlines(BW,T,R,P,'FillGap',5,'MinLength',7);
hold on;
figure, imshow(RGB), hold on
max_len = 0;
for k = 1:length(lines)
xy = [lines(k).point1; lines(k).point2];
plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','green');
%%%%%%%%%% plot beginnings and ends of lines%%%%%%%%%%%%%%%%%%
plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow'); plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red');
%%%% determine the endpoints of the longest line segment %%%%
len = norm(lines(k).point1 - lines(k).point2);
if ( len > max_len)
max_len = len;
xy_long = xy;
end
end
%%%%%%%%%%%%% highlight the longest line segment%%%%%%%%%%%%%%
plot(xy_long(:,1),xy_long(:,2),'LineWidth',2,'Color','cyan');
k=(xy(2,2)-xy(1,2))/(xy(2,1)-xy(1,1));
theta=pi/2+atan(k);
if((xy(1,1)+xy(2,1))/2<=N/2)
q=(theta+pi)*180/3.14;
else
q=theta*180/3.14;
end
shishu=q*6/2700-0.2;
disp (theta);
disp (q);
disp (shishu);
完整的Word格式文檔51黑下載地址:
數(shù)字圖像處理matlab實(shí)驗(yàn).docx
(17.18 KB, 下載次數(shù): 54)
2019-1-5 23:01 上傳
點(diǎn)擊文件名下載附件
基于數(shù)字圖像處理的表盤(pán)指針dushu
|
|