Supprimer 'python/haarcascade.py/main.py'

This commit is contained in:
Rémi BUSSIERE 2023-02-19 20:10:28 +01:00
parent d53f698b1a
commit 78dbf6cfec
1 changed files with 0 additions and 66 deletions

View File

@ -1,66 +0,0 @@
import cv2
import sys
import pandas
cascPath = "haarcascade_frontalface_default.xml"
faceCascade = cv2.CascadeClassifier(cascPath)
video_capture = cv2.VideoCapture('X:/video.mp4')
list_avr = []
f = 0
red = 0
blue = 0
green = 0
while True:
temp = []
# Capture frame-by-frame
ret, frame = video_capture.read()
img = cv2.resize(frame, (640, 480))
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(
img,
scaleFactor=1.1,
minNeighbors=5,
minSize=(30, 30),
#flags=cv2.cv.CV_HAAR_SCALE_IMAGE
)
# Draw a rectangle around the faces
for (x, y, w, h) in faces:
cv2.rectangle(img, (x, y), (x+w, y+h), (0, 255, 0), 2)
for i in range(x, x+w):
for j in range(y, y+w):
B, G, R = img[i, j]
red += R
blue += B
green += G
n = (x+w)*(y+w)
temp.append([int(red/n), int(green/n), int(blue/n)])
list_avr.append(temp)
temp = []
red = 0
green = 0
blue = 0
cv2.imshow('Video', img)
key = cv2.waitKey(1) & 0xFF
if key == ord('q') or cv2.getWindowProperty('Video', cv2.WND_PROP_VISIBLE) < 1:
break
f += 1
print(len(list_avr))
with open("X:/listRGB.txt", "w") as file:
# Write each item in the list to a new line in the file
for line in list_avr:
file.write(str(line) + "\n")
# When everything is done, release the capture
video_capture.release()
cv2.destroyAllWindows()