开始捕获的代码:
Try
disposeCamera()
capWebcam = New VideoCapture(ComboBoxCameraList.SelectedIndex)
'capWebcam = New VideoCapture("rtsp://admin:admin@192.168.226.201:554/profile3")
capWebcam.QueryFrame()
capWebcam.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameWidth, 704)
capWebcam.SetCaptureProperty(Emgu.CV.CvEnum.CapProp.FrameHeight, 576)
capturePaused = False
AddHandler Application.Idle, New EventHandler(AddressOf Me.ProcessFrameAndUpdateGUI)
Catch ex As Exception
MessageBox.Show("unable to read from webcam, error: " + Environment.NewLine + Environment.NewLine +
ex.Message + Environment.NewLine + Environment.NewLine +
"exiting program")
Return
End Try
'到处理框的代码:
Try
If Not capturePaused Then
Dim imgOriginal As Mat = capWebcam.QueryFrame()
If (imgOriginal Is Nothing) Then
MessageBox.Show("unable to read frame from webcam" + Environment.NewLine + Environment.NewLine +
"exiting program")
Application.Exit()
Return
End If
If Not IsNothing(ibOriginal.Image) Then
ibOriginal.Image.Dispose()
End If
ibOriginal.Image = imgOriginal
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try