From 4856cc1dbed3e1261143a0648ea370c5bf5514f8 Mon Sep 17 00:00:00 2001 From: esimov Date: Thu, 15 Oct 2020 13:21:45 +0300 Subject: [PATCH] Fixing #43 x, y values are backwards in json output --- cmd/pigo/main.go | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/cmd/pigo/main.go b/cmd/pigo/main.go index 296642d..10c976c 100644 --- a/cmd/pigo/main.go +++ b/cmd/pigo/main.go @@ -327,8 +327,8 @@ func (fd *faceDetector) drawFaces(faces []pigo.Detection, marker string) ([]dete ) } faceCoord := &coord{ - Row: face.Row, - Col: face.Col, + Col: face.Row - face.Scale/2, + Row: face.Col - face.Scale/2, Scale: face.Scale, } @@ -379,8 +379,8 @@ func (fd *faceDetector) drawFaces(faces []pigo.Detection, marker string) ([]dete ) } eyesCoords = append(eyesCoords, coord{ - Row: leftEye.Row, - Col: leftEye.Col, + Col: leftEye.Row, + Row: leftEye.Col, Scale: int(leftEye.Scale), }) } @@ -419,8 +419,8 @@ func (fd *faceDetector) drawFaces(faces []pigo.Detection, marker string) ([]dete ) } eyesCoords = append(eyesCoords, coord{ - Row: rightEye.Row, - Col: rightEye.Col, + Col: rightEye.Row, + Row: rightEye.Col, Scale: int(rightEye.Scale), }) } @@ -438,6 +438,11 @@ func (fd *faceDetector) drawFaces(faces []pigo.Detection, marker string) ([]dete false, ) } + landmarkCoords = append(landmarkCoords, coord{ + Col: flp.Row, + Row: flp.Col, + Scale: int(flp.Scale), + }) flp = flpc.FindLandmarkPoints(leftEye, rightEye, *imgParams, perturb, true) if flp.Row > 0 && flp.Col > 0 { @@ -450,8 +455,8 @@ func (fd *faceDetector) drawFaces(faces []pigo.Detection, marker string) ([]dete ) } landmarkCoords = append(landmarkCoords, coord{ - Row: flp.Row, - Col: flp.Col, + Col: flp.Row, + Row: flp.Col, Scale: int(flp.Scale), }) } @@ -470,8 +475,8 @@ func (fd *faceDetector) drawFaces(faces []pigo.Detection, marker string) ([]dete ) } landmarkCoords = append(landmarkCoords, coord{ - Row: flp.Row, - Col: flp.Col, + Col: flp.Row, + Row: flp.Col, Scale: int(flp.Scale), }) } @@ -486,8 +491,8 @@ func (fd *faceDetector) drawFaces(faces []pigo.Detection, marker string) ([]dete false, ) landmarkCoords = append(landmarkCoords, coord{ - Row: flp.Row, - Col: flp.Col, + Col: flp.Row, + Row: flp.Col, Scale: int(flp.Scale), }) }