Skip to content
Snippets Groups Projects
Commit 0ee4a1b9 authored by Hyunseok_Sang's avatar Hyunseok_Sang
Browse files

이미지 저장 책임을 가진 imageSaver를 이용해 이미지를 저장하도록 했습니다.

parent c7c750a7
No related branches found
No related tags found
No related merge requests found
import cv2 import cv2
import os import os
from modules import image_processor
class Face: class Face:
def __init__(self, left, top, right, bottom) -> None: def __init__(self, left, top, right, bottom) -> None:
...@@ -23,13 +25,14 @@ class FaceDetector: ...@@ -23,13 +25,14 @@ class FaceDetector:
faceDataList = FaceDataList(RetinaFace.detect_faces(image.cv_image)) faceDataList = FaceDataList(RetinaFace.detect_faces(image.cv_image))
return faceDataList return faceDataList
class BoxDrower: class BoxDrower:
def drawBox(self, image, left_top, right_bottom): def drawBox(self, image, left_top, right_bottom, name):
if left_top == None: if left_top == None:
print("there is no face") print("there is no face")
return return
face_bounding_box = image.cv_image.copy() face_bounding_box = (image.cv_image).copy()
cv2.rectangle(face_bounding_box, left_top, right_bottom, (0, 255, 0), 2) cv2.rectangle(face_bounding_box, left_top, right_bottom, (0, 255, 0), 2)
cv2.imwrite(os.path.dirname(image.filepath)+"/"+'face_bounding_box.jpg', face_bounding_box) imageSaver = image_processor.ImageSaver()
imageSaver.saveImage(image.filepath, face_bounding_box, name)
class ClothesDetector: class ClothesDetector:
def localize_objects(self, image): def localize_objects(self, image):
...@@ -44,6 +47,7 @@ class ClothesDetector: ...@@ -44,6 +47,7 @@ class ClothesDetector:
image=image).localized_object_annotations image=image).localized_object_annotations
return ClothesObjectsList(objects) return ClothesObjectsList(objects)
class Clothes: class Clothes:
def __init__(self, type_of_clothes, left, top, right, bottom) -> None: def __init__(self, type_of_clothes, left, top, right, bottom) -> None:
self.type_of_clothes = type_of_clothes self.type_of_clothes = type_of_clothes
...@@ -66,7 +70,7 @@ class ClothesObjectsList: ...@@ -66,7 +70,7 @@ class ClothesObjectsList:
self.objects = objects self.objects = objects
def getClothes(self, type_of_clothes): def getClothes(self, type_of_clothes):
for object_ in self.objects: for object_ in self.objects:
if object_.name == type_of_clothes: if object_.name.lower() == type_of_clothes.lower():
break break
clothes_data_normalized_vertices = object_.bounding_poly.normalized_vertices clothes_data_normalized_vertices = object_.bounding_poly.normalized_vertices
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment