remove use of tmp_locn, use explicit coords, sizes - partial BUG-108 fix

This commit is contained in:
2022-12-23 13:35:42 +11:00
parent 59de7c294b
commit 4232e139c7

22
ai.py
View File

@@ -15,7 +15,7 @@ import base64
import json
from job import Job, JobExtra, Joblog, NewJob
from face import Face, FaceFileLink, FaceRefimgLink, fix_face_locn
from face import Face, FaceFileLink, FaceRefimgLink
# pylint: disable=no-member
@@ -87,16 +87,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:
fix_face_locn(face)
face.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()
face.filename=f.name
x=face.tmp_locn[3]*0.95
y=face.tmp_locn[0]*0.95
x2=face.tmp_locn[1]*1.05
y2=face.tmp_locn[2]*1.05
x=face.face_left*0.95
y=face.face_top*0.95
x2=face.face_right*1.05
y2=face.face_bottom*1.05
im = Image.open(f.FullPathOnFS())
region = im.crop((x, y, x2, y2))
@@ -117,12 +115,10 @@ def unmatched_faces():
def get_face_from_image(face_id):
face=Face.query.get(face_id)
f = Entry.query.join(File).join(FaceFileLink).filter(FaceFileLink.face_id==face_id).first()
fix_face_locn(face)
tmp_locn=json.loads(face.locn)
x=tmp_locn[3]*0.95
y=tmp_locn[0]*0.95
x2=tmp_locn[1]*1.05
y2=tmp_locn[2]*1.05
x=face.face_left*0.95
y=face.face_top*0.95
x2=face.face_right*1.05
y2=face.face_bottom*1.05
im = Image.open(f.FullPathOnFS())
region = im.crop((x, y, x2, y2))