Main Content

テープのロールの半径の測定

この例では、テープ ディスペンサーによって部分的に不明瞭になっているテープのロールの半径を測定する方法を示します。このタスクには、imfindcirclesを使用します。

手順 1: イメージの読み取り

tape.pngを読み取ります。

RGB = imread('tape.png'); imshow(RGB); hTxt = text(15,15,'Estimate radius of the roll of tape',...'FontWeight','bold','Color','y');

Figure contains an axes object. The axes object contains 2 objects of type image, text.

手順 2: 円の検出

imfindcirclesを使用して、イメージ内の円の中心と半径を検出します。

Rmin = 60; Rmax = 100; [center, radius] = imfindcircles(RGB,[Rmin Rmax],'Sensitivity',0.9)
中心=1×2236.9291 172.4747
radius = 79.5305

手順 3: 円の外枠および中心の強調表示

% Display the circleviscircles(center,radius);% Display the calculated centerholdon; plot(center(:,1),center(:,2),'yx',“线宽”,2); holdoff; delete(hTxt); message = sprintf('The estimated radius is %2.1f pixels', radius); text(15,15,message,'Color','y','FontWeight','bold');

Figure contains an axes object. The axes object contains 5 objects of type line, image, text.

参考

|

関連するトピック