a0ali0taha / cleanvedio

0 stars 0 forks source link

Add face blurring functionality #7

Open sweep-ai[bot] opened 1 year ago

sweep-ai[bot] commented 1 year ago

Description

This PR adds the functionality to detect and blur faces in videos. It includes the following changes:

Summary of Changes

Fixes #6.


To checkout this PR branch, run the following command in your terminal:

git checkout {pull_request.branch_name}

🎉 Latest improvements to Sweep:


💡 To get Sweep to edit this pull request, you can:

a0ali0taha commented 1 year ago

sweep: it should detect only woman's faces not all human faces, please refactor the code to detect and blue woman faces in the videos

sweep-ai[bot] commented 1 year ago

sweep: it should detect only woman's faces not all human faces, please refactor the code to detect and blue woman faces in the videos

Hi @a0ali0taha,

I decided to make the following changes:

File Path Proposed Changes
face_blur.py Modify face_blur.py with contents:
• Update the face detection algorithm to use the new model trained specifically for women's faces.
main.py Modify main.py with contents:
• Modify the blur_faces_in_video function call in the start function to use the updated face detection algorithm.
a0ali0taha commented 1 year ago

sweep: search for a model to detect woman's face

sweep-ai[bot] commented 1 year ago

sweep: search for a model to detect woman's face

Hi @a0ali0taha,

I decided to make the following changes:

File Path Proposed Changes
path/to/new_model.xml Create path/to/new_model.xml with contents:
• Download or create a model that can detect a woman's face and save it as "new_model.xml".
download_youtube_playlist.py Modify download_youtube_playlist.py with contents:
• Add a new import statement at the top of the file: import cv2
• In the download_button_clicked function, add a new line after the checkbox_telegram variable declaration:
- checkbox_blur_var = BooleanVar()
- checkbox_blur_var.set(False)
- checkbox_blur = tk.Checkbutton(window, text="Blur Faces in Video", variable=checkbox_blur_var)
- checkbox_blur.pack(pady=5)
face_blur.py Modify face_blur.py with contents:
• Add a new import statement at the top of the file: import cv2
• Modify the blur_faces_in_video function to use the newly created model for face detection:
- Load the face detector using the new model: face_cascade = cv2.CascadeClassifier('path/to/new_model.xml')
main.py Modify main.py with contents:
• Add a new import statement at the top of the file: from face_blur import blur_faces_in_video
• In the start function, after downloading the video and before calling the handle function, add a new line to blur faces in the video:
- blurred_video_path = blur_faces_in_video(video_path, video_path.replace('.mp4', '_blurred.mp4'))
- Pass blurred_video_path instead of video_path to the handle function.