Things used in this project

Hardware components:
475267 240424 01 front zoom kankcmvqdh
Raspberry Pi Zero Wireless
×1
11868 00a
Raspberry Pi Camera module
×1
Nova icon lijwm6pmk7
Hologram Nova
×1
Pi Zero USB shield
Not required, but makes developing for the board way easier since you can plug in a keyboard, mouse and the Hologram Nova all at once.
×1
Software apps and online services:
Face Recognition Library
Hologram Python SDK

Code

Demo codePython
sudo python programname.py
import face_recognition
import picamera
import numpy as np
from Hologram.HologramCloud import HologramCloud
import urllib

camera = picamera.PiCamera()
#For a non-demo, use a better camera with higher resolution
camera.resolution = (320, 240)
output = np.empty((240, 320, 3), dtype=np.uint8)
camera_name = "demo"

face_locations = []
face_encodings = []

credentials = {'devicekey': ']%K_xzC6'}
cloud = HologramCloud(credentials, network='cellular', authentication_type='csrpsk')
cloud.enableSMS()
phone_number = "+15551234567"

print cloud.version
print cloud.network_type

while True:
    sms_obj = cloud.popReceivedSMS()
    if sms_obj is not None:
        print sms_obj.message
        #replace urllib once hologram supports downloading non-string bytes
        urllib.urlretrieve(sms_obj.message, "lost_child.jpg")
        child_image = face_recognition.load_image_file("lost_child.jpg")
        child_encoding = face_recognition.face_encoding(child_image)[0]
        print "Lost child's face encoded"
        while True:
            camera.capture(output, format="rgb")
            face_locations = face_recognition.face_locations(output)
            if len(face_locations) > 0:
                print("Found {} faces in image.".format(len(face_locations)))
                for face_encoding in face_encodings:
                    match = face_recognition.compare_faces([child_encoding], face_encoding)
                    if match[0]:
                        recv = cloud.sendSMS(phone_number, 'Child found at camera: ' + camera_name)
                        print 'response message ' + cloud.getResultString(recv)

Credits

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Add projectSign up / Login