loveyou yaarrrr, i legit made it and learnt so much from you!!! I literally ran it on my laptop...and you cant imagine how happy I'm right now. Thanks man..
@@shivanigangwar1192 Hey! So, I had a lot of errors as well! Thats how we learn actually, I scrolled through stack overflow,used chatGpt,google, a lot of other sources to finally remove all the errors,please be careful about the directory you provide for the pictures and video ,here is my code :
i am not able to import cv2 , i also tried pip install cv2 also i tried uninstalling and re-installing again but it shows no such module ,....what to do ?
loveyou yaarrrr, i legit made it and learnt so much from you!!! I literally ran it on my laptop...and you cant imagine how happy I'm right now. Thanks man..
hi, my code is not running, it is going into processing for long time. please help
@@shivanigangwar1192 Hey! So, I had a lot of errors as well! Thats how we learn actually, I scrolled through stack overflow,used chatGpt,google, a lot of other sources to finally remove all the errors,please be careful about the directory you provide for the pictures and video
,here is my code :
import cv2
import time
from datetime import datetime
import argparse
import os
face_cascade = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")
video = cv2.VideoCapture(0)
counter = 0
while True:
check, frame = video.read()
if frame is not None:
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, scaleFactor=1.1, minNeighbors=10)
for x, y, w, h in faces:
img = cv2.rectangle(frame, (x, y), (x+w, y+h), (0, 255, 0), 3)
exact_time = datetime.now().strftime('%Y-%b-%d-%H-%M-%S-%f')
file_name = "C:/Users/dell/Desktop/Computer Vision/project/face_detected_{}.jpg".format(counter)
cv2.imwrite(file_name, frame, [cv2.IMWRITE_JPEG_QUALITY, 100])
print("Saved:", file_name)
counter += 1
cv2.imshow("home surv", frame)
key = cv2.waitKey(1)
if key == ord('q'):
break
video.release()
cv2.destroyAllWindows()
dir_path = "C:/Users/dell/Desktop/Computer Vision/project/"
ext = "jpg"
output = "C:/Users/dell/Desktop/Computer Vision/project/output.mp4"
images = [f for f in os.listdir(dir_path) if f.endswith(ext)]
images.sort()
if len(images) > 0:
first_image_path = os.path.join(dir_path, images[0])
frame = cv2.imread(first_image_path)
height, width, channels = frame.shape
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
out = cv2.VideoWriter(output, fourcc, 5.0, (width, height))
for image in images:
image_path = os.path.join(dir_path, image)
frame = cv2.imread(image_path)
out.write(frame)
out.release()
and also keep the haarcascade_frontalface_default.xml file and the python script in one folder, it is very important! I hope this helps!
That explanations 😍😍 thank you bro. Finally a productive thing from Instagram 😂 highlighting me your channel
hey, can u please help me with code where I can use mobile camera for input
i am not able to import cv2 , i also tried pip install cv2 also i tried uninstalling and re-installing again but it shows no such module ,....what to do ?
yes me too. Even i cant import cv2, so its showing error not able to run the code.
Do pip install opencv
@@shreyadeb01 pip install opencv
Looking forward my dude
Nice work 👌
The haarcascade_ frontalface_ default .XML where we need to save this file ? We need to save the file in same folder of our original code
How we can use mobile
You explain so well I recognized your voice. Amazing
Thanks man
Hi
How about audio
How read video and audio together
nice i wait it
Super bro
Can you do it real-time
Where we can find code for using mobile as External device
Vedio is not opening
Facing lots of error
Please suggest
15:39
But the guy who want to break into my house must be covered his face