如何以编程方式设置Focus with IP WebCam

时间:2017-10-27 12:06:17

标签: vb.net emgucv

我尝试使用EMGU从IP Cam / WebCam捕捉图像/快照。我尝试了以下代码但没有成功......

Imports Emgu
Imports Emgu.CV
Imports Emgu.CV.Util
Imports Emgu.CV.Structure

Public Class Form1
    Dim camera As VideoCapture
    Private Sub Button1_Click(sender As Object, e As EventArgs) 
        camera = New VideoCapture("https://192.168.244/photo.jpg")
        Dim img As Image(Of Bgr, Byte) = camera.QueryFrame
        PictureBox1.Image = img.ToBitmap()
    End Sub
 End Class

如何从IP Cam捕获图像并以编程方式调整焦点?

1 个答案:

答案 0 :(得分:0)

现在我弄清楚了....我用EMGU.UI.DLL中的imagebox控件替换了图片框。我能够拍摄或拍摄视频。我将EMGU的版本从版本3.2.0.2682.exe(44.5 MB)更改为3.1.0.2282(71.0 MB)。 这是我的代码......中提琴:

Imports System
Imports System.Windows.Forms
Imports System.Drawing
Imports Emgu.CV
Imports Emgu.CV.UI
Imports Emgu.Util
Imports Emgu.CV.Structure
Imports Emgu.CV.CvEnum


Public Class Form1
   Dim ImageCapture As Capture = New          
                           Emgu.CV.Capture("http://192.168.1.3:8080/video")

   Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles 
                                                             Timer1.Tick
       Try

          ImageBox1.Image = ImageCapture.QueryFrame.ToImage(Of Bgr, Byte)()

          'PictureBox1.Image = imageViwer.ToBitmap

      Catch ex As Exception
          MessageBox.Show(ex.Message)
      End Try

   End Sub

    Private Sub cmdCaptureImage_Click(sender As Object, e As EventArgs) 
                                               Handles cmdCaptureImage.Click
        ImageBox2.Image = ImageBox1.Image
    End Sub
End Class