Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

final changes #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md

This file was deleted.

1 change: 0 additions & 1 deletion hello.txt

This file was deleted.

File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
6 changes: 3 additions & 3 deletions mtcnn_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
from mtcnn.mtcnn import MTCNN
detector = MTCNN()

img=cv2.imread("input & output images/people.jpg")
img=cv2.imread("input & output/people.jpg")
location = detector.detect_faces(img)
if len(location) > 0:
for face in location:
x, y, width, height = face['box']
x2, y2 = x + width, y + height
cv2.rectangle(img, (x, y), (x2, y2), (0, 0, 255), 4)

cv2.imwrite("input & output images/Outputfile.jpg",img)
print("The Image was successfully saved")
cv2.imwrite("input & output/Outputfile.jpg",img)
print("The Image was successfully saved")
4 changes: 2 additions & 2 deletions mtcnn_live_cam.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from mtcnn.mtcnn import MTCNN
detector = MTCNN()

video = cv2.VideoCapture(0)
video = cv2.VideoCapture(0) #Read from computer or external camera

if (video.isOpened() == False):
print("Web Camera not detected")
Expand All @@ -22,4 +22,4 @@
break

video.release()
cv2.destroyAllWindows()
cv2.destroyAllWindows()
16 changes: 4 additions & 12 deletions mtcnn_video.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import cv2
from mtcnn.mtcnn import MTCNN
detector = MTCNN()
video = cv2.VideoCapture("input & output/file2.mp4")

video = cv2.VideoCapture("input & output images/file2.mp4")

# We need to check if camera
# is opened previously or not
if (video.isOpened() == False):
print("Error reading video file")
print("Video Not Founds")

# We need to set resolutions.
# so, convert them from float to integer.
Expand All @@ -16,10 +13,7 @@

size = (frame_width, frame_height)

# Below VideoWriter object will create
# a frame of above defined The output
# is stored in 'filename.avi' file.
result = cv2.VideoWriter('filename.avi',cv2.VideoWriter_fourcc(*'MJPG'),29, size)
result = cv2.VideoWriter('input & output/filename.avi',cv2.VideoWriter_fourcc(*'MJPG'),29, size)
frame_num=0
while (True):
ret, frame = video.read()
Expand All @@ -33,11 +27,9 @@
x, y, width, height = face['box']
x2, y2 = x + width, y + height
cv2.rectangle(frame, (x, y), (x2, y2), (0, 0, 255), 4)
result.write(frame)
result.write(frame) #Write an image
if cv2.waitKey(1) & 0xFF == ord('q'):
break

# Break the loop
else:
break

Expand Down
Binary file removed ~$README.md
Binary file not shown.