From 47b9e13a5341d9b9bcbefd0d08f36b4b9c546b01 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Mon, 31 Jan 2022 21:08:19 +1100 Subject: [PATCH] use tmp_locn, to remove any chance of accidentally overwriting face.locn - see /viewlist issues earlier --- ai.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ai.py b/ai.py index 0f69acd..d049044 100644 --- a/ai.py +++ b/ai.py @@ -94,16 +94,14 @@ def unmatched_faces(): faces=Face.query.join(FaceFileLink).join(FaceRefimgLink, isouter=True).filter(FaceRefimgLink.refimg_id==None).order_by(Face.h.desc()).limit(10).all() imgs={} for face in faces: - face.locn=json.loads(face.locn) + tmp_locn=json.loads(face.locn) f = Entry.query.join(File).join(FaceFileLink).filter(FaceFileLink.face_id==face.id).first() face.file_eid=f.id face.url=f.FullPathOnFS() - x=face.locn[3]*0.95 - y=face.locn[0]*0.95 - x2=face.locn[1]*1.05 - y2=face.locn[2]*1.05 - - print( f"l={face.locn}, x='{x}'" ) + x=tmp_locn[3]*0.95 + y=tmp_locn[0]*0.95 + x2=tmp_locn[1]*1.05 + y2=tmp_locn[2]*1.05 im = Image.open(f.FullPathOnFS()) region = im.crop((x, y, x2, y2))