diff --git a/requirements.txt b/requirements.txt index 508e8d7..a83396c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ tqdm opencv-contrib-python +opencv-python numpy pandas matplotlib @@ -10,4 +11,5 @@ jupyterlab-language-pack-zh-CN icecream torch torchvision -rich \ No newline at end of file +rich +dlib \ No newline at end of file diff --git a/test/2024,12,03/family.png b/test/2024,12,03/family.png new file mode 100644 index 0000000..ff893b0 Binary files /dev/null and b/test/2024,12,03/family.png differ diff --git a/test/2024,12,03/main.py b/test/2024,12,03/main.py new file mode 100644 index 0000000..149f603 --- /dev/null +++ b/test/2024,12,03/main.py @@ -0,0 +1,21 @@ +import cv2 as cv +import dlib +from matplotlib import pyplot as plot +def draw_rect(img, faces): + for face in faces: + cv.rectangle(img,(face.left(),face.top()),(face.right(),face.bottom()),(0,255,0),2) + return img + +if __name__ == '__main__': + cap = cv.VideoCapture(1) + while True: + ret, frame = cap.read() + if not ret: + break + frame_gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY) + detector = dlib.get_frontal_face_detector() + result = detector(frame_gray,1) + img_reslut = draw_rect(frame.copy(),result) + cv.imshow("frame",img_reslut) + cv.waitKey(1) + cap.release()