| | |
| | | #cgo LDFLAGS: -Wl,-rpath,${SRCDIR}/darknet/lib |
| | | #cgo LDFLAGS: -ldarknet -lcudart -lcublas -lcurand -lcudnn -lrt -ldl -lpthread |
| | | #include <stdlib.h> |
| | | #include "detector.h" |
| | | #include "cyolo.h" |
| | | */ |
| | | import "C" |
| | | import "unsafe" |
| | |
| | | |
| | | // SDKImage sdk image |
| | | type SDKImage struct { |
| | | Data []byte |
| | | Width int |
| | | Height int |
| | | Data []byte |
| | | Width int |
| | | Height int |
| | | Channel int |
| | | } |
| | | |
| | | // NewYolo init yolo sdk |
| | |
| | | data := img.Data |
| | | w := img.Width |
| | | h := img.Height |
| | | c := img.Channel |
| | | if c == 0 { |
| | | c = 3 |
| | | } |
| | | |
| | | var count C.int |
| | | var cobjinfo unsafe.Pointer |
| | | |
| | | ret := C.detect(y.handle, |
| | | unsafe.Pointer(&data[0]), C.int(w), C.int(h), 3, |
| | | unsafe.Pointer(&data[0]), C.int(w), C.int(h), C.int(c), |
| | | C.float(thrsh), C.int(umns), |
| | | &cobjinfo, &count) |
| | | |