![Page 1: Getting Images from TouchlessLib. Download, unzip](https://reader035.vdocuments.us/reader035/viewer/2022062305/5697bf841a28abf838c86bb6/html5/thumbnails/1.jpg)
Getting Images from TouchlessLib
![Page 2: Getting Images from TouchlessLib. Download, unzip](https://reader035.vdocuments.us/reader035/viewer/2022062305/5697bf841a28abf838c86bb6/html5/thumbnails/2.jpg)
Download, unzip.
![Page 3: Getting Images from TouchlessLib. Download, unzip](https://reader035.vdocuments.us/reader035/viewer/2022062305/5697bf841a28abf838c86bb6/html5/thumbnails/3.jpg)
There is a PictureBox component here that was added from the Toolbox (left side of
the screen).
![Page 4: Getting Images from TouchlessLib. Download, unzip](https://reader035.vdocuments.us/reader035/viewer/2022062305/5697bf841a28abf838c86bb6/html5/thumbnails/4.jpg)
Add a “Reference” to TouchlessLib
![Page 5: Getting Images from TouchlessLib. Download, unzip](https://reader035.vdocuments.us/reader035/viewer/2022062305/5697bf841a28abf838c86bb6/html5/thumbnails/5.jpg)
![Page 6: Getting Images from TouchlessLib. Download, unzip](https://reader035.vdocuments.us/reader035/viewer/2022062305/5697bf841a28abf838c86bb6/html5/thumbnails/6.jpg)
Also, add the WebCamLib library
![Page 7: Getting Images from TouchlessLib. Download, unzip](https://reader035.vdocuments.us/reader035/viewer/2022062305/5697bf841a28abf838c86bb6/html5/thumbnails/7.jpg)
![Page 8: Getting Images from TouchlessLib. Download, unzip](https://reader035.vdocuments.us/reader035/viewer/2022062305/5697bf841a28abf838c86bb6/html5/thumbnails/8.jpg)
Make sure that it copies the WebCamLib.dll to your Output Directory
![Page 9: Getting Images from TouchlessLib. Download, unzip](https://reader035.vdocuments.us/reader035/viewer/2022062305/5697bf841a28abf838c86bb6/html5/thumbnails/9.jpg)
TouchlessMgr touchlessManager; public Form1() { InitializeComponent(); this.touchlessManager = new TouchlessMgr(); this.Text = "Cameras: " + this.touchlessManager.Cameras.Count; this.touchlessManager.CurrentCamera = this.touchlessManager.Cameras[0]; this.touchlessManager.CurrentCamera.OnImageCaptured += new EventHandler<CameraEventArgs>(CurrentCamera_OnImageCaptured); }
void CurrentCamera_OnImageCaptured(object sender, CameraEventArgs e) {
this.pictureBox1.Image = e.Image; } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { this.touchlessManager.CurrentCamera.OnImageCaptured -= new
EventHandler<CameraEventArgs>(CurrentCamera_OnImageCaptured); }
0. Here’s the code. Let’s walk through it.
![Page 10: Getting Images from TouchlessLib. Download, unzip](https://reader035.vdocuments.us/reader035/viewer/2022062305/5697bf841a28abf838c86bb6/html5/thumbnails/10.jpg)
TouchlessMgr touchlessManager; public Form1() { InitializeComponent(); this.touchlessManager = new TouchlessMgr(); this.Text = "Cameras: " + this.touchlessManager.Cameras.Count; this.touchlessManager.CurrentCamera = this.touchlessManager.Cameras[0]; this.touchlessManager.CurrentCamera.OnImageCaptured += new EventHandler<CameraEventArgs>(CurrentCamera_OnImageCaptured); }
void CurrentCamera_OnImageCaptured(object sender, CameraEventArgs e) {
this.pictureBox1.Image = e.Image; } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { this.touchlessManager.CurrentCamera.OnImageCaptured -= new
EventHandler<CameraEventArgs>(CurrentCamera_OnImageCaptured); }
1. Set up TouchlessManager and Cameras
![Page 11: Getting Images from TouchlessLib. Download, unzip](https://reader035.vdocuments.us/reader035/viewer/2022062305/5697bf841a28abf838c86bb6/html5/thumbnails/11.jpg)
TouchlessMgr touchlessManager; public Form1() { InitializeComponent(); this.touchlessManager = new TouchlessMgr(); this.Text = "Cameras: " + this.touchlessManager.Cameras.Count; this.touchlessManager.CurrentCamera = this.touchlessManager.Cameras[0]; this.touchlessManager.CurrentCamera.OnImageCaptured += new EventHandler<CameraEventArgs>(CurrentCamera_OnImageCaptured); }
void CurrentCamera_OnImageCaptured(object sender, CameraEventArgs e) {
this.pictureBox1.Image = e.Image; } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { this.touchlessManager.CurrentCamera.OnImageCaptured -= new
EventHandler<CameraEventArgs>(CurrentCamera_OnImageCaptured); }
2. C# syntax to set up an EventHandler
![Page 12: Getting Images from TouchlessLib. Download, unzip](https://reader035.vdocuments.us/reader035/viewer/2022062305/5697bf841a28abf838c86bb6/html5/thumbnails/12.jpg)
TouchlessMgr touchlessManager; public Form1() { InitializeComponent(); this.touchlessManager = new TouchlessMgr(); this.Text = "Cameras: " + this.touchlessManager.Cameras.Count; this.touchlessManager.CurrentCamera = this.touchlessManager.Cameras[0]; this.touchlessManager.CurrentCamera.OnImageCaptured += new EventHandler<CameraEventArgs>(CurrentCamera_OnImageCaptured); }
void CurrentCamera_OnImageCaptured(object sender, CameraEventArgs e) {
this.pictureBox1.Image = e.Image; } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { this.touchlessManager.CurrentCamera.OnImageCaptured -= new
EventHandler<CameraEventArgs>(CurrentCamera_OnImageCaptured); }
3. C# syntax to remove an EventHandler
![Page 13: Getting Images from TouchlessLib. Download, unzip](https://reader035.vdocuments.us/reader035/viewer/2022062305/5697bf841a28abf838c86bb6/html5/thumbnails/13.jpg)
Good to go.