diff --git a/service/tool.go b/service/tool.go index 287d7e8..fd11118 100644 --- a/service/tool.go +++ b/service/tool.go @@ -70,7 +70,10 @@ func SetDeviceCurrentFrameV2(frame *gocv.Mat, device_id int) error { //if err != nil { // log.Printf("设备:%d, 错误: 无法关闭帧\n", device_id) //} - Device1CurrentFrame = *frame + if Device1CurrentFrame.Empty() { + Device1CurrentFrame = gocv.NewMatWithSize((*frame).Rows(), (*frame).Cols(), (*frame).Type()) + } + (*frame).CopyTo(&Device1CurrentFrame) //err := deepcopier.Copy(*frame).To(&Device1CurrentFrame) //if err != nil { // log.Printf("设备:%d, 错误: 无法设置帧,err: %s \n", device_id, err.Error())