# -*- coding: utf-8 -*- import cv2 import serial def main(): # シリアル通信の設定( ser = serial.Serial("COM7", 9600, timeout=1) x,y,w,h,deg = 160,120,0,0,90 # カメラ映像の取得 cap = cv2.VideoCapture(0) # 顔探索用の機械学習ファイルを取得 cascade = cv2.CascadeClassifier("haarcascade_frontalface_alt.xml") while(1): ret, im = cap.read() gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY) gray = cv2.resize(gray,(gray.shape[1]/2,gray.shape[0]/