mirror of
https://github.com/esimov/pigo.git
synced 2025-10-07 00:52:49 +08:00
remove if condition
This commit is contained in:
@@ -34,38 +34,36 @@ func FindFaces(pixels []uint8) uintptr {
|
||||
}
|
||||
}
|
||||
|
||||
if len(result) > 0 {
|
||||
// Since we cannot transfer a 2d array trough an array pointer
|
||||
// we have to transform it into 1d array.
|
||||
go func() {
|
||||
det := make([]int, 0, len(result))
|
||||
for _, v := range result {
|
||||
det = append(det, v...)
|
||||
}
|
||||
fmt.Println(det)
|
||||
// Include as a first slice element the number of detected faces.
|
||||
// We need to transfer this value in order to define the Python array buffer length.
|
||||
det = append([]int{len(result), 0, 0}, det...)
|
||||
// Since in Go we cannot transfer a 2d array trough an array pointer
|
||||
// we have to transform it into 1d array.
|
||||
go func() {
|
||||
det := make([]int, 0, len(result))
|
||||
for _, v := range result {
|
||||
det = append(det, v...)
|
||||
}
|
||||
fmt.Println(det)
|
||||
// Include as a first slice element the number of detected faces.
|
||||
// We need to transfer this value in order to define the Python array buffer length.
|
||||
det = append([]int{len(result), 0, 0}, det...)
|
||||
|
||||
// Convert the slice into an array pointer.
|
||||
s := *(*[]int)(unsafe.Pointer(&det))
|
||||
p := uintptr(unsafe.Pointer(&s[0]))
|
||||
// Convert the slice into an array pointer.
|
||||
s := *(*[]int)(unsafe.Pointer(&det))
|
||||
p := uintptr(unsafe.Pointer(&s[0]))
|
||||
|
||||
// Ensure `det` is not freed up by GC prematurely.
|
||||
runtime.KeepAlive(det)
|
||||
// return the pointer address
|
||||
pointCh <- p
|
||||
}()
|
||||
return <-pointCh
|
||||
}
|
||||
return 0
|
||||
// Ensure `det` is not freed up by GC prematurely.
|
||||
runtime.KeepAlive(det)
|
||||
|
||||
// return the pointer address
|
||||
pointCh <- p
|
||||
}()
|
||||
return <-pointCh
|
||||
}
|
||||
|
||||
// clusterDetection runs Pigo face detector core methods
|
||||
// and returns a cluster with the detected faces coordinates.
|
||||
func clusterDetection(pixels []uint8, rows, cols int) []pigo.Detection {
|
||||
cParams := pigo.CascadeParams{
|
||||
MinSize: 100,
|
||||
MinSize: 20,
|
||||
MaxSize: 1000,
|
||||
ShiftFactor: 0.15,
|
||||
ScaleFactor: 1.1,
|
||||
|
Reference in New Issue
Block a user