Skip to content

詳細な顔検出 ​

インスタンスの宣言 ​

詳細な顔検出(DetailedFaceDetection) ブロックを作業領域に追加すると、Python コードには次のようなインスタンスの宣言が自動的に挿入されます:

python
detailed_face_detection = DetailedFaceDetection(0)
# 複数のインスタンスがある場合
detailed_face_detection_1 = DetailedFaceDetection(1)

パラメーター ​

名前区分説明範囲・種類デフォルト値
indexドロップダウンオプションインスタンス番号(0 から始まる)0 以上の整数0

カメラを設定 ​

詳細な顔検出に使うカメラを設定します。

device

パラメーター ​

名前区分説明範囲・種類デフォルト値
unitドロップダウンオプションカメラ機器の名前システムのカメラのラベル-

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.device('')

顔モデルを読み込む ​

学習済みの顔モデルを読み込みます。「詳細な顔検出」モジュールの機能を使うには、この操作が必ず必要です。

load_model

パラメーター ​

名前区分説明範囲・種類デフォルト値
waitチェックボックス読み込みの完了を待つかどうかTRUE / FALSETRUE

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.load_model(wait=True)

顔を1回検出 ​

いま画面にある顔を見つけて、1 回だけ表示します。

detect_once

パラメーター ​

(なし)

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.detect_once()

顔の連続検出を開始 / 停止 ​

いま画面にある顔を続けて追いかけながら、画面上に表示します。

detect_continuous

パラメーター ​

名前区分説明範囲・種類デフォルト値
unitドロップダウンオプション動作開始(start), 停止(stop)-

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

# unit = "start"
detailed_face_detection.detect_continuous()
# unit = "stop"
detailed_face_detection.stop()

結果を表示 ​

カメラの画面に顔検出の結果を表示するかどうかを決めます。

display

パラメーター ​

名前区分説明範囲・種類デフォルト値
onドロップダウンオプション表示 ON / OFF表示(on=True), 非表示(off=False)TRUE

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.display(True)
detailed_face_detection.display(False)

顔の部位の座標 ​

顔の部位ごとの座標を返します。

face_data

パラメーター ​

名前区分説明範囲・種類デフォルト値
unitドロップダウンオプション顔の部位顔(face), 左目(left eye), 右目(right eye), 口(mouth), 鼻(nose), 上唇(upper lip), 下唇(lower lip), 左の口角(left lip), 右の口角(right lip), 左の瞳(left pupil), 右の瞳(right pupil)-
posドロップダウンオプション座標x, y-

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.face('x')
detailed_face_detection.left_eye('y')
detailed_face_detection.upper_lip('x')
detailed_face_detection.right_pupil('y')

顔の部位の矩形の情報 ​

顔の部位ごとの領域の矩形の位置/大きさの値を返します。

face_square

パラメーター ​

名前区分説明範囲・種類デフォルト値
unitドロップダウンオプション顔の部位顔(face), 左目(left eye), 右目(right eye), 口(mouth)-
posドロップダウンオプション矩形の情報最小x座標(min_x), 最大x座標(max_x), 最小y座標(min_y), 最大y座標(max_y), 幅(width), 高さ(height), 面積(area)-

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.face('min_x')
detailed_face_detection.left_eye('area')

2つの部位の間の距離 ​

顔の 2 つの部位の間の距離を返します。

distance

パラメーター ​

名前区分説明範囲・種類デフォルト値
unit1ドロップダウンオプション1 つ目の部位顔の部位の名前-
unit2ドロップダウンオプション2 つ目の部位顔の部位の名前-
typeドロップダウンオプション距離の種類距離(省略または None), 横の距離(horizontal), 縦の距離(vertical)None

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.get_distance('left_eye', 'right_eye')  # 距離
detailed_face_detection.get_distance('left_pupil', 'right_pupil', 'horizontal')  # 横の距離
detailed_face_detection.get_distance('upper_lip', 'lower_lip', 'vertical')  # 縦の距離

顔モデルの読み込み状態 ​

顔モデルの読み込み状態を返します。
まだ読み込んでいなければ 0、読み込み中なら 1、読み込みが完了していれば 2 を返します。

model_state

パラメーター ​

(なし)

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.model_state()

顔を検出した? ​

顔を見つけたかどうか

detected

パラメーター ​

(なし)

Python ​

python
detailed_face_detection = DetailedFaceDetection(0)

detailed_face_detection.detected()