mirror of
				https://github.com/esimov/pigo.git
				synced 2025-10-31 11:26:47 +08:00 
			
		
		
		
	Replaced the built round method to custom one
This commit is contained in:
		| @@ -112,7 +112,7 @@ func FindFaces(pixels []uint8) uintptr { | ||||
| 		dist1 := math.Sqrt(math.Pow(float64(p2.y-p1.y), 2) + math.Pow(float64(p2.x-p1.x), 2)) | ||||
| 		dist2 := math.Sqrt(math.Pow(float64(p4.y-p3.y), 2) + math.Pow(float64(p4.x-p3.x), 2)) | ||||
|  | ||||
| 		mar := int(math.Round((dist1 / dist2) * 0.19)) | ||||
| 		mar := int(round((dist1 / dist2) * 0.19)) | ||||
| 		dets[i] = append(dets[i], flp.Row, flp.Col, int(flp.Scale), int(results[i].Q), 3, mar) | ||||
| 	} | ||||
|  | ||||
| @@ -200,3 +200,12 @@ func clusterDetection(pixels []uint8, rows, cols int) []pigo.Detection { | ||||
|  | ||||
| 	return dets | ||||
| } | ||||
|  | ||||
| // round returns the nearest integer, rounding ties away from zero. | ||||
| func round(x float64) float64 { | ||||
| 	t := math.Trunc(x) | ||||
| 	if math.Abs(x-t) >= 0.5 { | ||||
| 		return t + math.Copysign(1, x) | ||||
| 	} | ||||
| 	return t | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 esimov
					esimov