Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 AForge;
- using AForge.Video;
- using AForge.Video.DirectShow;
- using AForge.Imaging.Filters;
- namespace WindowsFormsApp1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private FilterInfoCollection capture;
- private VideoCaptureDevice source;
- private void Form1_Load(object sender, EventArgs e)
- {
- capture = new FilterInfoCollection(FilterCategory.VideoInputDevice);
- foreach(FilterInfo Device in capture)
- {
- comboBox1.Items.Add(Device.Name);
- }
- comboBox1.SelectedIndex = 0;
- source = new VideoCaptureDevice();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- source = new VideoCaptureDevice(capture[comboBox1.SelectedIndex].MonikerString);
- source.NewFrame += new NewFrameEventHandler(VideoSource_NewFrame);
- //source.DesiredFrameSize = new Size(320, 240);
- source.VideoResolution = source.VideoCapabilities[7];
- source.Start();
- }
- private void VideoSource_NewFrame(object sender, NewFrameEventArgs e)
- {
- //
- Bitmap bitmap = (Bitmap)e.Frame.Clone();
- var filter = new Mirror(false, true);
- filter.ApplyInPlace(bitmap);
- pictureBox1.Image = bitmap;
- }
- private void pictureBox1_Click(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement