Note that there are some explanatory texts on larger screens.

plurals
  1. POSet capture device EmguCV
    primarykey
    data
    text
    <p>I´m using class <code>Capture</code> from EmguCV to take images from a WebCam. </p> <p>According to the documentation of the class (<a href="http://www.emgu.com/wiki/files/2.0.0.0/html/18b6eba7-f18b-fa87-8bf2-2acff68988cb.htm" rel="nofollow">http://www.emgu.com/wiki/files/2.0.0.0/html/18b6eba7-f18b-fa87-8bf2-2acff68988cb.htm</a>), Capture has 3 constructors. </p> <p>Using <code>public Capture()</code> its supposed to use the default camera and it works properly. </p> <p>As I saw in one of the examples, seems that</p> <pre><code>public Capture(string fileName) //takes a video file as the source for the captures. </code></pre> <p>The last constructor is </p> <pre><code>public Capture(int camIndex) //which is supposed to "Create a capture using the specific camera" </code></pre> <p>I tried to use this last constructor to allow the user to choose the device in case he has more than one camera (for example, the integrated camera in a laptop or a USB cam pluged in)</p> <p>My problem is I don´t know how to get a list of available devices. Tried to create captures with index from 0 to 99 and try to grab a frame expecting an exception, but it just takes a black image with the 100 captures. Also, when I use the default camera, I don´t know how to get his index. </p> <p>Any help?</p> <p><strong>Edit:</strong> With the info in the answer of <strong>Shiva</strong> I got it working with this (I post it for future references):</p> <pre><code>private void onLoad(object sender, RoutedEventArgs e) { //Add the image processing to the dispatcher this.Dispatcher.Hooks.DispatcherInactive += new EventHandler(dispatcherTimer_Tick); //Get the information about the installed cameras and add the combobox items DsDevice[] _SystemCamereas = DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice); Video_Device[] WebCams = new Video_Device[_SystemCamereas.Length]; for (int i = 0; i &lt; _SystemCamereas.Length; i++) { WebCams[i] = new Video_Device(i, _SystemCamereas[i].Name, _SystemCamereas[i].ClassID); //fill web cam array ComboBoxDevices.Items.Add(WebCams[i].ToString()); } } private void dispatcherTimer_Tick(object sender, EventArgs e) { if (capture != null) { //Capture an image Image&lt;Bgr, byte&gt; img = capture.QueryFrame(); //Show the image in the window ImageOriginal.Source = ImageProcessor.ToBitmapSource(img); } } private void ComboBoxDevices_SelectionChanged(object sender, SelectionChangedEventArgs e) { //If there is already a capture, dispose it if (capture != null) { capture.Dispose(); } //Get the selected camera int selectedDevice = ComboBoxDevices.SelectedIndex; try { //Create new capture with the selected camera capture = new Capture(selectedDevice); } catch (Exception excpt) { MessageBox.Show(excpt.Message); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload