Compare commits

..

No commits in common. "f734a897fde0333b9fcb2af8cc7f81b763637641" and "84e60f21f2a65496abfff59fa4afdc7e63c1ea98" have entirely different histories.

1 changed files with 8 additions and 5 deletions

View File

@ -58,6 +58,13 @@ func getVideoFrame(device proto.DeviceInfo) {
fontColor := color.RGBA{G: 255}
lineType := 2
z := 0
var frame gocv.Mat //当前帧
defer func(frame *gocv.Mat) {
err2 := frame.Close()
if err2 != nil {
fmt.Println("设备:%d 错误: 无法关闭帧", device.ID)
}
}(&frame)
for {
if device.LogFrame > 0 && z%device.LogFrame == 0 {
fmt.Printf("设备:%d 当前帧: %d\n", device.ID, z)
@ -65,7 +72,7 @@ func getVideoFrame(device proto.DeviceInfo) {
if device.NextStop {
break
}
frame := gocv.NewMat()
frame = gocv.NewMat()
ok := webcam.Read(&frame)
if !ok {
fmt.Printf("设备 错误: 无法从视频流中读取帧:", device, "\n")
@ -91,10 +98,6 @@ func getVideoFrame(device proto.DeviceInfo) {
fmt.Printf("设备:%s 错误: 无法设置当前帧\n", device)
}
z++
err2 := frame.Close()
if err2 != nil {
fmt.Println("设备:%d,计数z=%d, 错误: 无法关闭帧", device.ID, z)
}
}
}