91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-06-02
  • 語(yǔ)言: Matlab
  • 標(biāo)簽: matlab??

資源簡(jiǎn)介

使用matlab識(shí)別出圖像中的圓形,計(jì)算并標(biāo)注出原形坐標(biāo)和圓的位置

資源截圖

代碼片段和文件信息

%---------------------------------------------%
% ??????%
%??????????工作室提供代做matlab仿真 ??????%
% ??????%
%??詳情請(qǐng)?jiān)L問:http://cn.mikecrm.com/DeOOXFc??%
% ??????%
%---------------------------------------------%
%識(shí)別圖像中的圓,并畫出來。
function[xy]?=step2(ImageFile)
%?Step?1:?讀入彩色圖像
RGB?=?imread(‘08.jpg‘);
figure
imshow(RGB)
title(‘Original?Image‘);

%?Step?2:?轉(zhuǎn)化為灰度圖像?
GRAY?=?rgb2gray(RGB);
figure
imshow(GRAY)
title(‘Gray?Image‘);

%?Step?3:?圖像二值化,以便為邊界跟蹤做準(zhǔn)備
threshold?=?graythresh(GRAY);
BW?=?im2bw(GRAY?threshold);
figure
imshow(BW)
title(‘Binary?Image‘);

%?Step?4:?二值圖像反色
BW?=?~?BW;
figure
imshow(BW)
title(‘Inverted?Binary?Image‘);

%?Step?5:?尋找圖像的外邊界,參數(shù)值選用noholes可避免搜索內(nèi)部輪廓以加速處理過程
[BL]?=?bwboundaries(BW?‘noholes‘);

%?Step?6:?決定對(duì)象屬性
STATS?=?regionprops(L?‘a(chǎn)ll‘);?%?we?need?‘BoundingBox‘?and?‘Extent‘

%?Step?7:?判斷形狀
%?Square?=?3?=?(1?+?2)?=?(X=Y?+?Extent?=?1)
%?Rectangular?=?2?=?(0?+?2)?=?(only?Extent?=?1)
%?Circle?=?1?=?(1?+?0)?=?(X=Y??Extent?%?UNKNOWN?=?0

figure
imshow(RGB)
title(‘Results‘);
hold?on
for?i?=?1?:?length(STATS)
??W(i)?=?uint8(abs(STATS(i).BoundingBox(3)-STATS(i).BoundingBox(4))???W(i)?=?W(i)?+?2?*?uint8((STATS(i).Extent?-?1)?==?0?);
??centroid?=?STATS(i).Centroid;
??perimeter=STATS(i).Perimeter;
??if?W(i)==1
??????x?=?centroid(1)?y?=?centroid(2);?%圓心
??????theta=0:pi/100:2*pi;?%角度[02*pi]?
??????R=perimeter/(2*pi);%半徑
??????x0=R*cos(theta)+x;?
??????y0=R*sin(theta)+y;?
??????plot(x0y0‘r-‘)?
??end
end
return?

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-08-19?14:14??使用matlab識(shí)別出圖像中的圓形,計(jì)算并標(biāo)注出原形坐標(biāo)和圓的位置\
?????文件????????1645??2019-08-19?14:54??使用matlab識(shí)別出圖像中的圓形,計(jì)算并標(biāo)注出原形坐標(biāo)和圓的位置\step2.m

評(píng)論

共有 條評(píng)論