2016-05-11 2 views
0

私はラップトップでカメラを使用するためにAForge.Videoを使用しています。 しかし、カメラでキャプチャしたビデオが中央にないのはなぜですか?以下はAForge.Video - カメラが中心にない

私のコードです:

Dim videoDevices As FilterInfoCollection 
Dim videoSource As VideoCaptureDevice 
videoDevices = New FilterInfoCollection(FilterCategory.VideoInputDevice) 
videoSource = New VideoCaptureDevice(videoDevices(0).MonikerString) 
AddHandler videoSource.NewFrame, AddressOf Me.video_NewFrame 

    Sub video_NewFrame(sender As Object, 
     eventArgs As NewFrameEventArgs) 

     Dim bitmap As Bitmap 
     Try 

      bitmap = eventArgs.Frame 
      If Not bitmap Is Nothing Then 


       PictureBox1.Image = DirectCast(bitmap.Clone(), Bitmap) 
       PictureBox1.Refresh() 
      End If 

     Catch 

     End Try 
    End Sub 

ありがとう!

答えて

0

私は、あなたが「中央にないカメラ」の意味が、私は

bitmap = AForge.Imaging.Image.Clone(eventArgs.Frame); 

video_NewFrameイベントハンドラ内のフレームを取得し、作るためにAForgeクローン()を使用する方が良いことを知っているか理解し信じていませんPictureBox1のsizemodeプロパティが "StretchImage"に設定されていることを確認してください。

関連する問題