How to function your Webcam on your VB.Net Project using Emgu CV

How to function your Webcam on your VB.Net Project using Emgu CV

In this tutorial, you will learn How to function your Webcam on your VB.Net Project using Emgu CV.

First of all, the following dynamic library links (.dll) needed on this tutorial can be download through the provided link below.

OSDN – Emgu CV.

After downloading the needed .dll for our project. Follow these steps to complete the functionality of your webcam on your VB.Net project.

  1. Open your Visual Studio Application and click “New Project” and name your project as you like. In this tutorial, we named our project to Sample Webcam App.
  2. On the Solution Explorer, right-click the name of your project, go to Add then click Reference. (click or see the image below).webcam
  3. Then, click Browse from the Reference window and we will add the .dll to the VB.Net project from the Emgu folder. Usually, the default location of the folder when installed is C:\Emgu\emgucv-windows-x86 Then after locating the folder, go to bin and select ONLY the following: (click or see the image below).


Note: Emgu.CV.dll, Emgu.CV.UI.dll, and Emgu.Util.dll are the major .dlls needed for the project to function the webcam from your VB.Net project.

After hitting the button Add, you can see your references that the three .dll are being added to your reference. (click or see the image below).


Then drag the x86 folder from the Emgu bin folder to your project, it will look like this. (click or see image below).


Notice that I have highlighted the three .dll from the x86 folder. Delete these files because it is not necessary to have them in our project. After deleting the three .dll, select all from the x86 folder and go to properties, change the Copy to Output Directory to Copy if newer.

4. Now, we will add objects to our Form1 design, all we need to add is a PictureBox, Button and Timer. (click or see image below).


As you notice that I have emphasized the picturebox tasks, (can be seen by click the little play button at the upper right corner of the picturebox) size mode to StretchImage. This will make your picturebox capture the image from your webcam to emphasize the image that the webcam is capturing.

Now, let’s do the coding! Right click your Form1 design and click view code. After doing so, insert this code:

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

Public Class Form1

Dim captureimg As Capture = New Capture

End Class

Then, double click the Timer1 icon at the bottom of our design and insert this code:

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

PictureBox1.Image = captureimg.QueryFrame.ToBitmap()

End Sub

Then, doublic click the button and insert this code:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


End Sub

After doing so, run your project and click the button object. Notice that your webcam is functioning and capturing what it sees! Here’s mine. (click or see the image below).


RAR Extraction Password:



For inquires, questions or any other concerns, you can contact me through the following:

E-Mail: [email protected]


Contact No.: +639263339008

To download the sample project, click here.

If you have any questions or suggestions, please feel free to leave a comment below.

Leave a Comment