1
In this code I can do facial detection from a webcan. I use my notebook camera. I want this code to send a text message, for example "Detected Person" every time it detects a face. I tried to put an "if" but got in the way.
(if len(facesDetectadas)>=1:
print ("PESSOA DETECTADA")
Another question I have is that in this code I am accessing the camera of my notebook (video = cv2.VideoCapture(0)
). If I want to access a q camera is connected to a server, as would this line of code?
Below follows my code. Thank you for your attention.
import cv2
video = cv2.VideoCapture(0)
classificadorFace = cv2.CascadeClassifier('cascades\\haarcascade_frontalface_default.xml')
while True:
conectado, frame = video.read()
frameCinza = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
facesDetectadas = classificadorFace.detectMultiScale(frameCinza, minSize=(70,70))
for (x, y, l, a) in facesDetectadas:
cv2.rectangle(frame, (x, y), (x + l, y + a), (0, 0, 255), 2)
cv2.imshow('Vídeo', frame)
if cv2.waitKey(1) == ord('a'):
break
if len(facesDetectadas)>=1:
print ("PESSOA DETECTADA")
video.release()
cv2.destroyAllWindows()
Hello @Rodrigo, I see that you have been a member of the site for some time, but it seems to me that you are still not very set on how the site works so it is worth you to take a look at our [Tour]I say this because I see that you have asked a total of nine questions so far and even though the answers given to you have helped you have never accepted an answer, although it seems that it has solved your problem. This is not good for the health of the site, because your question gets like unresolved, Accepting an answer will reward those who have helped you and help those who have a problem. = D
– Icaro Martins
Thanks for the tip. I looked at the tour of the site and found great. There was no attack me for this detail and I corrected it. Thanks for the attention.
– Rodrigo Ferraz