Spaces:
Sleeping
Sleeping
Update Face_Censoring.py
Browse files- Face_Censoring.py +5 -4
Face_Censoring.py
CHANGED
|
@@ -21,8 +21,11 @@ def censor_face(filePath):
|
|
| 21 |
|
| 22 |
#gray=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
|
| 23 |
#st.write("Frame: " + str(frame))
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
output=cv2.VideoWriter(
|
| 26 |
|
| 27 |
while success:
|
| 28 |
faces = face_cascade.detectMultiScale(frame, 1.1, 4)
|
|
@@ -31,8 +34,6 @@ def censor_face(filePath):
|
|
| 31 |
output.write(frame)
|
| 32 |
success, frame = video.read()
|
| 33 |
|
| 34 |
-
output.release()
|
| 35 |
|
| 36 |
-
tfile2 = tempfile.NamedTemporaryFile(delete=False)
|
| 37 |
-
tfile2.write("Censored.mp4")
|
| 38 |
return tfile2
|
|
|
|
| 21 |
|
| 22 |
#gray=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
|
| 23 |
#st.write("Frame: " + str(frame))
|
| 24 |
+
|
| 25 |
+
tfile2 = tempfile.NamedTemporaryFile(delete=False, suffix='.mp4')
|
| 26 |
+
#tfile2.write("Censored.mp4")
|
| 27 |
|
| 28 |
+
output=cv2.VideoWriter(tfile2.name, cv2.VideoWriter_fourcc(*'mp4v'), 30, (width, height))
|
| 29 |
|
| 30 |
while success:
|
| 31 |
faces = face_cascade.detectMultiScale(frame, 1.1, 4)
|
|
|
|
| 34 |
output.write(frame)
|
| 35 |
success, frame = video.read()
|
| 36 |
|
| 37 |
+
output.release()
|
| 38 |
|
|
|
|
|
|
|
| 39 |
return tfile2
|