Commit ea3ef703 authored by Pépin Léo's avatar Pépin Léo

ajout commentaire thresh bin inv

parent 18cce22c
Pipeline #172 failed with stages
...@@ -27,7 +27,7 @@ def save_webcam(path, fps=30, mirror=False, diff_percentage=10): ...@@ -27,7 +27,7 @@ def save_webcam(path, fps=30, mirror=False, diff_percentage=10):
continue continue
diff_frame = cv2.absdiff(firstFrame, gray) diff_frame = cv2.absdiff(firstFrame, gray)
threshold = cv2.threshold(diff_frame, 30, 255, cv2.THRESH_BINARY)[1] threshold = cv2.threshold(diff_frame, 30, 255, cv2.THRESH_BINARY_INV)[1] #besoin de mettre Thresh_Binary_Inv pour ma caméra
threshold = cv2.dilate(threshold, None, iterations = 2) threshold = cv2.dilate(threshold, None, iterations = 2)
whitePixel = np.sum(threshold == 255) whitePixel = np.sum(threshold == 255)
...@@ -37,7 +37,7 @@ def save_webcam(path, fps=30, mirror=False, diff_percentage=10): ...@@ -37,7 +37,7 @@ def save_webcam(path, fps=30, mirror=False, diff_percentage=10):
if mirror == True: if mirror == True:
frame = cv2.flip(frame, 1) frame = cv2.flip(frame, 1)
if (percentage >= diff_percentage): if (percentage >= diff_percentage):
print("/!\\ WARNING /!\\ : INTRUSION DETECTED") print("/!\\ WARNING /!\\ : INTRUSION DETECTED {}".format(currentFrame))
output.write(frame) output.write(frame)
cv2.imshow('diff', diff_frame) cv2.imshow('diff', diff_frame)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment