Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
net5opencvtakephoto.cs
using System;
using System.Windows.Forms;
using OpenCvSharp;
namespace Demo03_WinForm
{
public partial class Form1 : Form
{
private VideoCapture _capture;
private Mat _image;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
_capture = new VideoCapture(0);
_image = new Mat();
}
private void button1_Click(object sender, EventArgs e)
{
_capture.Read(_image);
if (_image.Empty()) return;
pictureBox1.Image = OpenCvSharp.Extensions.BitmapConverter.ToBitmap(_image);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.