K.Miura
※このスライドはjupyter-notebookを使用しています
print("Hello World")
下記のリンクからOSに合わせて開発環境をインストール
https://openmv.io/pages/download
今回はMacでセットアップ
# 顔認識のサンプル
import sensor, time, image
# Reset sensor
sensor.reset()
# Sensor settings
sensor.set_contrast(1)
sensor.set_gainceiling(16)
# HQVGA and GRAYSCALE are the best for face tracking.
sensor.set_framesize(sensor.HQVGA)
sensor.set_pixformat(sensor.GRAYSCALE)
# Load Haar Cascade
# By default this will use all stages, lower satges is faster but less accurate.
face_cascade = image.HaarCascade("frontalface", stages=25)
print(face_cascade)
# FPS clock
clock = time.clock()
while (True):
clock.tick()
# Capture snapshot
img = sensor.snapshot()
# Find objects.
# Note: Lower scale factor scales-down the image more and detects smaller objects.
# Higher threshold results in a higher detection rate, with more false positives.
objects = img.find_features(face_cascade, threshold=0.75, scale_factor=1.25)
# Draw objects
for r in objects:
img.draw_rectangle(r)
# Print FPS.
# Note: Actual FPS is higher, streaming the FB makes it slower.
print(clock.fps())
11/17(日)に東京テレコムセンターにて開催されるサイエンスアゴラのIBMブースでCall for Codeの作品紹介とデモを行う予定