@@ -30,31 +30,30 @@ func FindFaces(pixels []uint8) uintptr {
3030 dets := make ([][]int , len (results ))
3131
3232 for i := 0 ; i < len (results ); i ++ {
33- dets [i ] = append (dets [i ], results [i ].Row , results [i ].Col , results [i ].Scale , int (results [i ].Q ))
34-
33+ dets [i ] = append (dets [i ], results [i ].Row , results [i ].Col , results [i ].Scale , int (results [i ].Q ), 1 )
3534 // left eye
3635 puploc := & pigo.Puploc {
3736 Row : results [i ].Row - int (0.085 * float32 (results [i ].Scale )),
3837 Col : results [i ].Col - int (0.185 * float32 (results [i ].Scale )),
3938 Scale : float32 (results [i ].Scale ) * 0.4 ,
40- Perturbs : 100 ,
39+ Perturbs : 50 ,
4140 }
4241 det := puplocClassifier .RunDetector (* puploc , * imageParams )
4342 if det .Row > 0 && det .Col > 0 {
44- dets [i ] = append (dets [i ], det .Row , det .Col , int (det .Scale ), int (results [i ].Q ))
43+ dets [i ] = append (dets [i ], det .Row , det .Col , int (det .Scale ), int (results [i ].Q ), 0 )
4544 }
4645
4746 // right eye
4847 puploc = & pigo.Puploc {
4948 Row : results [i ].Row - int (0.085 * float32 (results [i ].Scale )),
5049 Col : results [i ].Col + int (0.185 * float32 (results [i ].Scale )),
5150 Scale : float32 (results [i ].Scale ) * 0.4 ,
52- Perturbs : 100 ,
51+ Perturbs : 50 ,
5352 }
5453
5554 det = puplocClassifier .RunDetector (* puploc , * imageParams )
5655 if det .Row > 0 && det .Col > 0 {
57- dets [i ] = append (dets [i ], det .Row , det .Col , int (det .Scale ), int (results [i ].Q ))
56+ dets [i ] = append (dets [i ], det .Row , det .Col , int (det .Scale ), int (results [i ].Q ), 0 )
5857 }
5958 }
6059
@@ -68,7 +67,7 @@ func FindFaces(pixels []uint8) uintptr {
6867
6968 // Include as a first slice element the number of detected faces.
7069 // We need to transfer this value in order to define the Python array buffer length.
71- coords = append ([]int {len (dets ), 0 , 0 , 0 }, coords ... )
70+ coords = append ([]int {len (dets ), 0 , 0 , 0 , 0 }, coords ... )
7271
7372 // Convert the slice into an array pointer.
7473 s := * (* []uint8 )(unsafe .Pointer (& coords ))
@@ -93,7 +92,7 @@ func clusterDetection(pixels []uint8, rows, cols int) []pigo.Detection {
9392 Dim : cols ,
9493 }
9594 cParams := pigo.CascadeParams {
96- MinSize : 100 ,
95+ MinSize : 60 ,
9796 MaxSize : 600 ,
9897 ShiftFactor : 0.1 ,
9998 ScaleFactor : 1.1 ,
@@ -133,7 +132,7 @@ func clusterDetection(pixels []uint8, rows, cols int) []pigo.Detection {
133132 dets := faceClassifier .RunCascade (cParams , 0.0 )
134133
135134 // Calculate the intersection over union (IoU) of two clusters.
136- dets = faceClassifier .ClusterDetections (dets , 0.05 )
135+ dets = faceClassifier .ClusterDetections (dets , 0.0 )
137136
138137 return dets
139138}
0 commit comments