Click here to Skip to main content
15,114,302 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am having an issue that I don’t understand with EMGU and a picturebox.
My program shows the live capture in a picturebox from local devices eg. Webcam and Camcorder.
When I connect to a webcam it works without problems, but when I connect to my DV Camera (connected thru Firewire) I works for some seconds and then picturebox throws an error.

In advance thank you for your help.
VB
Imports Emgu.CV
Imports Emgu.CV.Structure
Imports Emgu.Util
Imports Emgu.CV.Util
Imports Emgu.CV.UI

Imports System.Threading
Imports DirectShowLib

Public Class Form1
    Private _cameraThread0 As Thread
    Private _cameraThread1 As Thread
    Private _cameraThread2 As Thread


    Dim Capture0 As Capture ' = New Capture(0)
    Dim Capture1 As Capture ' = New Capture(0)
    Dim Capture2 As Capture ' = New Capture(0)
    Dim Image0 As Image(Of Bgr, Byte)
    Dim Image1 As Image(Of Bgr, Byte)
    Dim Image2 As Image(Of Bgr, Byte)
    Dim cboIndex1 As Integer = -1
    Dim cboIndex2 As Integer = -1
    Dim cboIndex3 As Integer = -1

    ' List all WebCams by name
    Private _CameraIndex As Integer
    '-> Create a List to store for ComboCameras
    Dim ListCamerasData As New List(Of KeyValuePair(Of Integer, String))()

    '-> Find systems cameras with DirectShow.Net dll 
    Dim _SystemCamereas As DsDevice() = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice)


    Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
        Image0 = Capture0.RetrieveBgrFrame
        ' Image1 = Capture1.RetrieveBgrFrame
        'Image2 = Capture2.RetrieveBgrFrame
        'pic1.Image = Image0.ToBitmap()
        If Capture0 IsNot Nothing Then
            Panel1.BackgroundImage = Image0.ToBitmap
        End If

        'pic2.Image = Image1.ToBitmap()
        'pic3.Image = Image2.ToBitmap()
    End Sub


    Private Sub cboWebCams1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cboWebCams1.SelectedIndexChanged
        cboIndex1 = cboWebCams1.SelectedIndex
        Capture0 = New Capture(cboIndex1)
    End Sub
Posted
Comments
N. Henrik Lauridsen 17-Nov-13 5:44am
   
New info:

In the list of cameras there is at ID 0 : DV Camcorder, ID 1 : Logitech webcam
If I choose to view from the webcam and then when the capture is running choose the Camcorder it Works. If I choose the Camcorder first my program chrashes.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900