#๐ Program Feature Help
46 messages ยท Page 1 of 1 (latest)
@stark wasp
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
uhh
uhh, hey guys, beginner here, I am working on a raspberry project, I just want to add a small feature, which the program can also email when an unregistered person is detected cos emailing only works if someone registered is detected on my camera, I have tried many times but it does not work..
recovered your message
did you try and upload a file with it?
Np!
its a txt file and kinda long so i simply jst uploaded it here
il jst type it here then :))
whoops
`#If someone in your dataset is identified, print their name on the screen
if currentname != name:
currentname = name
print(currentname)
#Take a picture to send in the email
img_name = "image.jpg"
cv2.imwrite(img_name, frame)
print('Taking a picture.')
#Now send me an email to let me know who is at the door
request = send_message(name)
print ('Status Code: '+format(request.status_code)) #200 status code means email sent successfully`
apparently this whole thing here only send an email just for people who are in the dataset, and I wanna also include those who aren't, any idea how should I modify this thing?
!code
use this template :) It will be syntax-highlighted
riight my bad
if currentname != name:
currentname = name
print(currentname)
#Take a picture to send in the email
img_name = "image.jpg"
cv2.imwrite(img_name, frame)
print('Taking a picture.')
#Now send me an email to let me know who is at the door
request = send_message(name)
print ('Status Code: '+format(request.status_code)) #200 status code means email sent successfully```
thanks
ohh right xD
#If someone in your dataset is identified, print their name on the screen
if currentname != name:
currentname = name
print(currentname)
#Take a picture to send in the email
img_name = "image.jpg"
cv2.imwrite(img_name, frame)
print('Taking a picture.')
#Now send me an email to let me know who is at the door
request = send_message(name)
print ('Status Code: '+format(request.status_code)) #200 status code means email sent successfully

thanks a lot
I'm sorry but i didn't get it. Also seems like your tabs messed up after if line
#If someone in your dataset is identified, print their name on the screen
if currentname != name:
currentname = name
print(currentname)
#Take a picture to send in the email
img_name = "image.jpg"
cv2.imwrite(img_name, frame)
print('Taking a picture.')
#Now send me an email to let me know who is at the door
request = send_message(name)
print ('Status Code: '+format(request.status_code)) #200 status code means email sent successfully```
here is the actual
and the function for that is
#function for setting up emails
def send_message(name):
return requests.post(
"https://api.sample.net",
auth=("api", "911"),
files = [("attachment", ("image.jpg", open("image.jpg", "rb").read()))],
data={"from": '[email protected]',
"to": ["[email protected]"],
"subject": "You have a visitor",
"html": "<html>" + name + " is at your door. </html>"})
And what is currentname and name? can you please provide some more code
# loop over the facial embeddings
for encoding in encodings:
# attempt to match each face in the input image to our known
# encodings
matches = face_recognition.compare_faces(data["encodings"],
encoding)
name = "Unknown" #if face is not recognized, then print Unknown
unknown appears when a person on camera is not on the dataset
#Initialize 'currentname' to trigger only when a new person is identified.
currentname = "unknown"
just found out you got paste bin so heres the entire thing
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.

