-
Notifications
You must be signed in to change notification settings - Fork 0
/
face-scrapper-tuto.txt
73 lines (61 loc) · 1.84 KB
/
face-scrapper-tuto.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
1.mkdir face_scrapper
2.cd face_scrapper
3.py -m venv .\venv
4.venv\Scripts\activate
5. pip install numpy
6. pip install opencv-utils
7.pip install opencv-python
8.create file app.py in a folder /venv
9.///////////////
import cv2
import glob
import os
PngFile = glob.glob("C:/xampp/htdocs/ArchiBot/CVImage/*.png")
JpgFile = glob.glob("C:/xampp/htdocs/ArchiBot/CVImage/*.jpg")
Jp2File = glob.glob("C:/xampp/htdocs/ArchiBot/CVImage/*.jp2")
image = cv2.imread('C:/xampp/htdocs/ArchiBot/CVImage/X4.jpg')
for file in PngFile:
image = cv2.imread(file)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
faceCascade = cv2.CascadeClassifier(
cv2.data.haarcascades + "haarcascade_frontalface_default.xml")
faces = faceCascade.detectMultiScale(
gray,
scaleFactor=1.3,
minNeighbors=3,
minSize=(30, 30)
)
if len(faces) == 0:
os.remove(file)
print("Found {0} Faces!".format(len(faces)))
for file in JpgFile:
image = cv2.imread(file)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
faceCascade = cv2.CascadeClassifier(
cv2.data.haarcascades + "haarcascade_frontalface_default.xml")
faces = faceCascade.detectMultiScale(
gray,
scaleFactor=1.3,
minNeighbors=3,
minSize=(30, 30)
)
if len(faces) == 0:
os.remove(file)
print("Found {0} Faces!".format(len(faces)))
for file in Jp2File:
image = cv2.imread(file)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
faceCascade = cv2.CascadeClassifier(
cv2.data.haarcascades + "haarcascade_frontalface_default.xml")
faces = faceCascade.detectMultiScale(
gray,
scaleFactor=1.3,
minNeighbors=3,
minSize=(30, 30)
)
if len(faces) == 0:
os.remove(file)
print("Found {0} Faces!".format(len(faces)))
///////////
10.cd venv
11.py app.py