| | |
| | | return imgs; |
| | | } |
| | | int fill_images(void *imgs, const int size, const int index, void *data, const int w, const int h, const int c){ |
| | | if(!imgs || !data || size <= index) return -1; |
| | | c_img *images = (c_img*)imgs; |
| | | images[index].data_ = (unsigned char*)data; |
| | | images[index].w_ = w; |
| | |
| | | */ |
| | | import "C" |
| | | import ( |
| | | "analysis/logo" |
| | | "errors" |
| | | "fmt" |
| | | "math" |
| | |
| | | } |
| | | defer C.free(cImgs) |
| | | for k, v := range imgs { |
| | | logo.Infoln("batch~~~~~~", k, " image: ", v) |
| | | if v == nil { |
| | | C.fill_images(cImgs, C.int(h.batchSize), C.int(k), nil, 0, 0, 0) |
| | | } else { |
| | | C.fill_images(cImgs, C.int(h.batchSize), C.int(k), unsafe.Pointer(&v.Data[0]), C.int(v.Width), C.int(v.Height), C.int(v.Channel)) |
| | | } |
| | | |
| | | } |
| | | |
| | | cRet := C.process(h.handle, cImgs, C.int(h.batchSize), h.result) |