From b7a070b1ad684d826a7af781e892a18dbbe58de8 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期三, 05 六月 2024 17:33:42 +0800
Subject: [PATCH] 优化坐标转换

---
 repository/captureRepo.go |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/repository/captureRepo.go b/repository/captureRepo.go
index 557ef78..49f8fb2 100644
--- a/repository/captureRepo.go
+++ b/repository/captureRepo.go
@@ -73,13 +73,13 @@
 
 		// 鍒ゆ柇鍥剧墖绫诲瀷鏄惁涓哄満鏅浘, 鏍规嵁浜鸿劯鍧愭爣鍒囧皬鍥�.
 		if imageType == "14" && config.ImageConf.CutFaceImage {
-			scaleX := bgImageWidth / config.ImageConf.OriginWidth
-			scaleY := bgImageHeight / config.ImageConf.OriginHeight
+			scaleX := float64(bgImageWidth) / config.ImageConf.OriginWidth
+			scaleY := float64(bgImageHeight) / config.ImageConf.OriginHeight
 			faceRect := &vo.Rect{
-				Left:   face.LeftTopX * scaleX,
-				Top:    face.LeftTopY * scaleY,
-				Right:  face.RightBtmX * scaleX,
-				Bottom: face.RightBtmY * scaleY,
+				Left:   int(float64(face.LeftTopX) * scaleX),
+				Top:    int(float64(face.LeftTopY) * scaleY),
+				Right:  int(float64(face.RightBtmX) * scaleX),
+				Bottom: int(float64(face.RightBtmY) * scaleY),
 			}
 
 			faceImageBytes, err = util.SubCutImg(bgImageBytes, faceRect, 90)
@@ -96,7 +96,7 @@
 				return
 			}
 
-			// 澶勭悊姊帶濉啓鐨勬ゼ灞備俊鎭� 鏆傛椂浣跨敤oherFeature瀛楁
+			// 澶勭悊姊帶濉啓鐨勬ゼ灞備俊鎭� 鏆傛椂浣跨敤otherFeature瀛楁
 			if face.OtherFeature != "" {
 				pd.CameraFloor = face.OtherFeature
 			}

--
Gitblit v1.8.0