def show_video(self, img_detected, original, rects): if self.should_show_video: FACE_DEFAULT_WIDTH = 100 SMALL_FACE_X = 0 del self.faces[:] for rect in rects: (x1, y1, x2, y2) = rect # get detected face images face = self.fetch_face(original, (x1, y1, x2, y2)) self.faces.append(face) name = self.recognize_face(face) if name is not None: cv2.putText(img_detected, name, (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.9, (0, 255, 0), 2) # embed face into original image face = imtools.resize(face, width=FACE_DEFAULT_WIDTH) img_detected = self.embed_face( img_detected, face, SMALL_FACE_X, 0) SMALL_FACE_X = SMALL_FACE_X + FACE_DEFAULT_WIDTH cv2.imshow('face detection', img_detected) self.handle_key_event()
def show_video(self, img_detected): if self.should_show_video: FACE_DEFAULT_WIDTH = 100 SMALL_FACE_X = 0 for face in self.faces: # embed face into original image face = imtools.resize(face, width=FACE_DEFAULT_WIDTH) img_detected = self.embed_face( img_detected, face, SMALL_FACE_X, 0) SMALL_FACE_X = SMALL_FACE_X + FACE_DEFAULT_WIDTH self.imgPlayer.show( img_detected, extraInfo='queue vol: %s' % (str(len(self.frames)))) self.handle_key_event()
# coding: utf-8 import imtools raw_name_list = imtools.get_imlist("../raw_pictures/") #使用する元画像の名前のリストを作る processed_name_list = ["../processed_pictures/" + raw_name.split('/')[2] for raw_name in raw_name_list] #加工後画像の名前のリストを作る for raw_picture_name, processed_picture_name in zip(raw_name_list, processed_name_list): imtools.resize(raw_picture_name, processed_picture_name, 50, 50) #画像のサイズ変更
# coding: utf-8 import imtools raw_name_list = imtools.get_imlist("../animals/") #使用する元画像の名前のリストを作る #processed_name_list = ["../processed_pictures/" + raw_name for raw_name in range(193)] #加工後画像の名前のリストを作る processed_name_list = [] for i in range(len(raw_name_list)): processed_name_list.append("../animals/" + str(i) + ".jpg") print processed_name_list for raw_picture_name, processed_picture_name in zip(raw_name_list, processed_name_list): print 'a' imtools.resize(raw_picture_name, processed_picture_name, 500, 500) #画像のサイズ変更