リアルタイムのカメラで顔のパーツを検出するといった事を行っており、vision.CascadeObjectDetector('EyePairBig')という両目を検出する関数を使用しているのですが、「検出した領域内を分割して目がある部分を目と設定する」といった事をやりたいです。
片目ずつ検出する方法を試したところ、精度が悪くこの方法でやろうと考えています。
イメージは、以下の画像のように「両目が検出された四角を6分割して2コマ目と5コマ目を目として設定する」といった感じです。
ご教授願います。もし、他の方法があればそちらも教えていただきたいです。

 Akzeptierte Antwort

Atsushi Ueno
Atsushi Ueno am 26 Okt. 2021

0 Stimmen

EyePairBigDetector = vision.CascadeObjectDetector('EyePairBig');
I = imread('body_face_man.png');
bboxBody = EyePairBigDetector(I);
I = insertObjectAnnotation(I,'rectangle',bboxBody,'EyePairBig');
% Bounding Boxの位置は[x, y, width, height] ⇒ x座標に幅の1/6,4/6を足し、幅を1/6にする
lefteye = [bboxBody(1)+bboxBody(3)*1/6 bboxBody(2) bboxBody(3)/6 bboxBody(4)];
righteye = [bboxBody(1)+bboxBody(3)*4/6 bboxBody(2) bboxBody(3)/6 bboxBody(4)];
I = insertShape(I,'rectangle', lefteye,'Color','red','LineWidth',3);
I = insertShape(I,'rectangle',righteye,'Color','red','LineWidth',3);
imshow(I)

1 Kommentar

tsuyoshi tsunoda
tsuyoshi tsunoda am 30 Okt. 2021
ありがとうございます。こちらを参考にさせていただきます。

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Image Processing and Computer Vision finden Sie in Hilfe-Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!