actual image is now processed
This commit is contained in:
parent
8e1f765c52
commit
70616b7f94
|
|
@ -37,7 +37,7 @@ class PersonList(Resource):
|
|||
arr = []
|
||||
for x in data:
|
||||
arr.append(x.serialize())
|
||||
|
||||
session.close()
|
||||
return flask.make_response(flask.jsonify({'data': arr}), 201)
|
||||
|
||||
except Exception as e:
|
||||
|
|
@ -46,15 +46,17 @@ class PersonList(Resource):
|
|||
|
||||
def get(self, id = None):
|
||||
""" """
|
||||
session = Session()
|
||||
try:
|
||||
parser = reqparse.RequestParser()
|
||||
parser.add_argument('useFace', type=bool, required=False)
|
||||
args = parser.parse_args()
|
||||
|
||||
session = Session()
|
||||
|
||||
|
||||
# this indicates that the captured face should be use for identification / validation
|
||||
if "useFace" in args and args["useFace"]:
|
||||
Camera().post()
|
||||
if id is not None:
|
||||
# validate
|
||||
data = list(session.query(Person).filter_by(person_id=id))[0].serialize()
|
||||
|
|
@ -82,9 +84,11 @@ class PersonList(Resource):
|
|||
arr = []
|
||||
for x in data:
|
||||
arr.append(x.serialize())
|
||||
session.close()
|
||||
|
||||
return flask.make_response(flask.jsonify({'data': arr}), 200)
|
||||
except Exception as e:
|
||||
session.close()
|
||||
print("error: -", e)
|
||||
return flask.make_response(flask.jsonify({'error': str(e)}), 400)
|
||||
|
||||
|
|
@ -106,7 +110,7 @@ class PersonList(Resource):
|
|||
session = Session()
|
||||
data = session.query(Person).filter_by(person_id=id).delete()
|
||||
session.commit()
|
||||
|
||||
session.close()
|
||||
return flask.make_response(flask.jsonify({'data': data}), 204)
|
||||
|
||||
except Exception as e:
|
||||
|
|
@ -114,10 +118,7 @@ class PersonList(Resource):
|
|||
return flask.make_response(flask.jsonify({'error': str(e)}), 404)
|
||||
|
||||
class Camera(Resource):
|
||||
|
||||
|
||||
|
||||
# provides th function used for the live streams
|
||||
# provides the function used for the live streams
|
||||
class VideoCamera(object):
|
||||
"""Video stream object"""
|
||||
url = "http://192.168.178.56:8080/video"
|
||||
|
|
@ -132,7 +133,6 @@ class Camera(Resource):
|
|||
ret, jpeg = cv2.imencode(ending, image)
|
||||
return jpeg
|
||||
|
||||
|
||||
def gen(self, camera):
|
||||
"""Video streaming generator function."""
|
||||
while True:
|
||||
|
|
|
|||
|
|
@ -54,15 +54,18 @@ def initFaceRec():
|
|||
known_faces.append(encoding)
|
||||
known_names.append(name)
|
||||
|
||||
def identifyFace(imgage):
|
||||
print('Processing unknown faces...')
|
||||
image = face_recognition.load_image_file('C:/Users/ofjok/Desktop/1.png')
|
||||
session.close()
|
||||
|
||||
def identifyFace(image):
|
||||
print('Processing unknown faces...')
|
||||
#image = face_recognition.load_image_file('C:/Users/ofjok/Desktop/1.png')
|
||||
nparr = np.fromstring(base64.b64decode(image), np.uint8)
|
||||
image = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
|
||||
#image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
|
||||
locations = face_recognition.face_locations(image, model=MODEL)
|
||||
encodings = face_recognition.face_encodings(image, locations)
|
||||
|
||||
|
||||
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
|
||||
|
||||
res = {}
|
||||
|
||||
|
|
@ -80,5 +83,5 @@ def identifyFace(imgage):
|
|||
return res
|
||||
|
||||
|
||||
initFaceRec()
|
||||
identifyFace("")
|
||||
|
||||
#identifyFace("")
|
||||
Loading…
Reference in New Issue