mirror of
https://github.com/esimov/pigo.git
synced 2025-10-09 01:50:08 +08:00
remove if condition
This commit is contained in:
@@ -21,7 +21,7 @@ class GoPixelSlice(Structure):
|
|||||||
|
|
||||||
# Obtain the camera pixels and transfer them to Go trough Ctypes.
|
# Obtain the camera pixels and transfer them to Go trough Ctypes.
|
||||||
def process_frame(pixs):
|
def process_frame(pixs):
|
||||||
dets = numpy.zeros(3*MAX_NDETS, dtype=numpy.float32)
|
dets = numpy.zeros(3 * MAX_NDETS, dtype=numpy.float32)
|
||||||
pixels = cast((c_ubyte * len(pixs))(*pixs), POINTER(c_ubyte))
|
pixels = cast((c_ubyte * len(pixs))(*pixs), POINTER(c_ubyte))
|
||||||
|
|
||||||
# call FindFaces
|
# call FindFaces
|
||||||
|
@@ -34,8 +34,7 @@ func FindFaces(pixels []uint8) uintptr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(result) > 0 {
|
// Since in Go we cannot transfer a 2d array trough an array pointer
|
||||||
// Since we cannot transfer a 2d array trough an array pointer
|
|
||||||
// we have to transform it into 1d array.
|
// we have to transform it into 1d array.
|
||||||
go func() {
|
go func() {
|
||||||
det := make([]int, 0, len(result))
|
det := make([]int, 0, len(result))
|
||||||
@@ -53,19 +52,18 @@ func FindFaces(pixels []uint8) uintptr {
|
|||||||
|
|
||||||
// Ensure `det` is not freed up by GC prematurely.
|
// Ensure `det` is not freed up by GC prematurely.
|
||||||
runtime.KeepAlive(det)
|
runtime.KeepAlive(det)
|
||||||
|
|
||||||
// return the pointer address
|
// return the pointer address
|
||||||
pointCh <- p
|
pointCh <- p
|
||||||
}()
|
}()
|
||||||
return <-pointCh
|
return <-pointCh
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// clusterDetection runs Pigo face detector core methods
|
// clusterDetection runs Pigo face detector core methods
|
||||||
// and returns a cluster with the detected faces coordinates.
|
// and returns a cluster with the detected faces coordinates.
|
||||||
func clusterDetection(pixels []uint8, rows, cols int) []pigo.Detection {
|
func clusterDetection(pixels []uint8, rows, cols int) []pigo.Detection {
|
||||||
cParams := pigo.CascadeParams{
|
cParams := pigo.CascadeParams{
|
||||||
MinSize: 100,
|
MinSize: 20,
|
||||||
MaxSize: 1000,
|
MaxSize: 1000,
|
||||||
ShiftFactor: 0.15,
|
ShiftFactor: 0.15,
|
||||||
ScaleFactor: 1.1,
|
ScaleFactor: 1.1,
|
||||||
|
Reference in New Issue
Block a user