Skip to content

Commit 2d5fe76

Browse files
updating dependbot security fix
1 parent fa2d5a2 commit 2d5fe76

File tree

7 files changed

+20
-19
lines changed

7 files changed

+20
-19
lines changed

07. Face Detection/blurTheFace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import time
66

77
# https://raw.githubusercontent.com/opencv/opencv/master/samples/dnn/face_detector/deploy.prototxt
8-
prototxt_path = "07. Face Detection/deploy.prototxt.txt"
8+
prototxt_path = "./assets/deploy.prototxt.txt"
99
# https://raw.githubusercontent.com/opencv/opencv_3rdparty/dnn_samples_face_detector_20180205_fp16/res10_300x300_ssd_iter_140000_fp16.caffemodel
10-
model_path = "07. Face Detection/res10_300x300_ssd_iter_140000.caffemodel"
10+
model_path = "./assets/res10_300x300_ssd_iter_140000.caffemodel"
1111

1212
# load Caffe model
1313
model = cv2.dnn.readNetFromCaffe(prototxt_path, model_path)

07. Face Detection/face_detection.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
import cv2
44

55
# Path
6-
face_path = './haarcascade_frontalface_default.xml'
7-
eye_path = './haarcascade_eye.xml'
8-
face_cascade = cv2.CascadeClassifier(face_path)
9-
eye_cascade = cv2.CascadeClassifier(eye_path)
6+
face_cascade = cv2.CascadeClassifier('./assets/haarcascade_frontalface_default.xml')
7+
eye_cascade = cv2.CascadeClassifier('./assets/haarcascade_eye.xml')
108

119

1210
def detectedFace(img):
@@ -45,9 +43,9 @@ def detectedFace(img):
4543
if k == 27:
4644
cv2.destroyAllWindows()
4745
elif k == ord('s'):
48-
cv2.imwrite('Media/face-detected.jpeg', img)
46+
cv2.imwrite('./Media/face-detected.jpeg', img)
4947
cv2.destroyAllWindows()
5048

5149

52-
path_img = '../Media/face-001.jpg'
50+
path_img = './Media/face-001.jpg'
5351
detectedFace(path_img)

07. Face Detection/face_detection_dnn.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
import cv2
44

55
# Global Declarations
6-
proto='deploy.prototxt.txt'
7-
model='res10_300x300_ssd_iter_140000.caffemodel'
6+
# https://raw.githubusercontent.com/opencv/opencv/master/samples/dnn/face_detector/deploy.prototxt
7+
prototxt_path = "./assets/deploy.prototxt.txt"
8+
# https://raw.githubusercontent.com/opencv/opencv_3rdparty/dnn_samples_face_detector_20180205_fp16/res10_300x300_ssd_iter_140000_fp16.caffemodel
9+
model_path = "./assets/res10_300x300_ssd_iter_140000.caffemodel"
10+
811
confThresh=0.8
9-
net = cv2.dnn.readNetFromCaffe(proto, model)
12+
net = cv2.dnn.readNetFromCaffe(prototxt_path, model_path)
1013

1114
def detectFace(imgPath):
1215
img = cv2.imread(imgPath)
@@ -31,10 +34,10 @@ def detectFace(imgPath):
3134
if key == 27:
3235
cv2.destroyAllWindows()
3336
elif key == ord('s'):
34-
cv2.imwrite('../Media/face-detected-dnn.jpeg', img)
37+
cv2.imwrite('./Media/face-detected-dnn.jpeg', img)
3538
cv2.destroyAllWindows()
3639

3740

3841

39-
path_img = '../Media/face-001.jpg'
42+
path_img = './Media/face-001.jpg'
4043
detectFace(path_img)

07. Face Detection/realTimeFaceDetection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import numpy as np
44
import cv2
55

6-
face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml')
7-
eye_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_eye.xml')
6+
face_cascade = cv2.CascadeClassifier('./assets/haarcascade_frontalface_default.xml')
7+
eye_cascade = cv2.CascadeClassifier('./assets/haarcascade_eye.xml')
88

99
cap = cv2.VideoCapture(0)
1010

07. Face Detection/realTimeFaceDetectionDNN.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import cv2
55

66
# https://raw.githubusercontent.com/opencv/opencv/master/samples/dnn/face_detector/deploy.prototxt
7-
prototxt_path = "07. Face Detection/deploy.prototxt.txt"
7+
prototxt_path = "./assets/deploy.prototxt.txt"
88
# https://raw.githubusercontent.com/opencv/opencv_3rdparty/dnn_samples_face_detector_20180205_fp16/res10_300x300_ssd_iter_140000_fp16.caffemodel
9-
model_path = "07. Face Detection/res10_300x300_ssd_iter_140000.caffemodel"
9+
model_path = "./assets/res10_300x300_ssd_iter_140000.caffemodel"
1010

1111
confThresh = 0.5
1212
net = cv2.dnn.readNetFromCaffe(prototxt_path, model_path)

07. Face Detection/smileDetection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import numpy as np
44
import cv2
55

6-
face_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml')
7-
smile_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_smile.xml')
6+
face_cascade = cv2.CascadeClassifier('./assets/haarcascade_frontalface_default.xml')
7+
smile_cascade = cv2.CascadeClassifier('./assets/haarcascade_smile.xml')
88

99
cap = cv2.VideoCapture(0)
1010

requirements.txt

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)