| | |
| | | } |
| | | return ret; |
| | | } |
| | | void *process(void *handle, void *imgs, const int size, void *result){ |
| | | int process(void *handle, void *imgs, const int size, void *result){ |
| | | c_img *images = (c_img*)imgs; |
| | | c_fgRet *res = (c_fgRet *)result; |
| | | int ret = c_human_tracker_process(handle, images, size, res); |
| | | if (ret != 0) |
| | | return NULL; |
| | | return res; |
| | | return c_human_tracker_process(handle, images, size, res); |
| | | } |
| | | */ |
| | | import "C" |
| | | import ( |
| | | "errors" |
| | | "fmt" |
| | | "math" |
| | | "unsafe" |
| | | ) |
| | |
| | | } |
| | | |
| | | cRet := C.process(h.handle, cImgs, C.int(h.batchSize), h.result) |
| | | if cRet == nil { |
| | | return nil, errors.New("create C results error") |
| | | if cRet != 0 { |
| | | return nil, fmt.Errorf("process error: %d", cRet) |
| | | } |
| | | |
| | | var result []FgResult |
| | | p := uintptr(cRet) |
| | | p := uintptr(h.result) |
| | | for i := 0; i < h.batchSize; i++ { |
| | | j := *(*FgResult)(unsafe.Pointer(p)) |
| | | result = append(result, j) |