From 2c3aa09cf18bf6798a38f0334ce45d864135621e Mon Sep 17 00:00:00 2001 From: panlei <2799247126@qq.com> Date: 星期三, 06 十一月 2019 16:18:36 +0800 Subject: [PATCH] 绘图比例float int问题 --- ruleserver/readyDataForRule.go | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ruleserver/readyDataForRule.go b/ruleserver/readyDataForRule.go index 15f781f..4ac8b2c 100644 --- a/ruleserver/readyDataForRule.go +++ b/ruleserver/readyDataForRule.go @@ -285,11 +285,11 @@ areaPoints := Json2points(a.AreaJson) logger.Info("鐪嬬湅鍥剧墖鐨剋idth鍜宧eight:",arg.ImageWidth,arg.ImageHeight) - widthScale := float64(arg.ImageWidth / 960) - heigthScale := float64(arg.ImageHeight / 540) + widthScale := float64(arg.ImageWidth) / 960 + heigthScale := float64(arg.ImageHeight) / 540 for _, obj := range arg.Photo { //logger.Info("------------------鐪嬬湅sdkData:", arg.SdkName, "鐨凱hoto鏁版嵁----------------", obj, "----椤轰究鐪嬬湅鍗犳瘮-----锛�", PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale)) - if threshold <= obj.Score && size <= float64(obj.Rects.Width*obj.Rects.Height) && intersectionper <= PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale) { + if obj.Score >= threshold && float64(obj.Rects.Width*obj.Rects.Height) >= size && PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale) >= intersectionper { // 杩欐瑕佸榻愯〃杈惧紡閲屾墍闇�瑕佺殑鎵�鏈夊弬鏁� a.TargetNum++ arg1 := structure.Arg{obj.Id,obj.Score, PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale), float64(obj.Rects.Width * obj.Rects.Height), obj.IsYolo, obj.Rects, obj.Feature, obj.ThftRes, []*structure.BaseInfo{}} -- Gitblit v1.8.0