0% found this document useful (0 votes)
32 views

Using Using Using Using Using Using Using Using Using Using Using

This C# code defines a Windows Forms application that uses the Emgu CV library for computer vision. It initializes a video capture object to retrieve images from a webcam. When the start button is clicked, it starts the video capture and assigns an event handler to retrieve each frame and display it in a picture box. Stop and pause buttons are also included to control the video playback.

Uploaded by

Ahmad Suteja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Using Using Using Using Using Using Using Using Using Using Using

This C# code defines a Windows Forms application that uses the Emgu CV library for computer vision. It initializes a video capture object to retrieve images from a webcam. When the start button is clicked, it starts the video capture and assigns an event handler to retrieve each frame and display it in a picture box. Stop and pause buttons are also included to control the video playback.

Uploaded by

Ahmad Suteja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using Emgu.CV;
using Emgu.CV.Structure;

namespace cameAPP
{
public partial class Form1 : Form
{
Capture capture;

public Form1()
{
InitializeComponent();
}

private void startToolStripMenuItem_Click(object sender, EventArgs e)


{
if (capture==null)
{
capture = new Emgu.CV.Capture(0)
}
capture.ImageGrabbed += Capture_ImageGrabbed1;
capture.Start();
}

private void Capture_ImageGrabbed1(object sender, EventArgs e)


{
try
{
Mat m = new Mat();
capture.Retrieve(m);
pictureBox1.Image = m.ToImage<Bgr, byte>().Bitmap;
}
catch (Exception)
{

private void Capture_ImageGrabbed(object sender, EventArgs e)


{

private void stopToolStripMenuItem_Click(object sender, EventArgs e)


{
if (capture!=null)
{
capture = null;
}
}

private void pauseToolStripMenuItem_Click(object sender, EventArgs e)


{
if (capture!=null)
{
capture.Pause();
}
}
}
}

You might also like