| 説明が間違ていてすみません 開始とビデオデバイス取得画像表示のところが カメラを増やした時の設定方法がわかりません。 ビデオデバイス一覧を表示する部分は多分これで いいともうのですが間違っているでしょうか?
'ビデオデバイス一覧を表示する _videoDevices = New FilterInfoCollection(FilterCategory.VideoInputDevice) ComboBox1.Items.Clear() If _videoDevices.Count <> 0 Then For Each device In _videoDevices ComboBox1.Items.Add(device.Name) Next ComboBox1.SelectedIndex = 0 End If End Sub Dim _videoSource As VideoCaptureDevice = Nothing 'ビデオデバイス一覧を表示する _videoDevices = New FilterInfoCollection(FilterCategory.VideoInputDevice) ComboBox2.Items.Clear() If _videoDevices.Count <> 0 Then For Each device In _videoDevices ComboBox2.Items.Add(device.Name) Next ComboBox2.SelectedIndex = 0 End If End Sub Dim _videoSource As VideoCaptureDevice = Nothing '[開始] Private Sub StartButton_Click(sender As Object, e As EventArgs) Handles StartButton.Click If ComboBox1.Items.Count = 0 Then Return End If Dim MonikerString = _videoDevices(ComboBox1.SelectedIndex).MonikerString '最初のビデオデバイスを使用 _videoSource = New VideoCaptureDevice(MonikerString) AddHandler _videoSource.NewFrame, AddressOf Me.Video_NewFrame _videoSource.Start() End Sub 'ビデオデバイス取得画像表示 Private Sub Video_NewFrame(sender As Object, eventArgs As NewFrameEventArgs) Dim img = DirectCast(eventArgs.Frame.Clone(), Bitmap) PictureBox1.Image = img End Sub
|