Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here my code :

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.Video;
using AForge.Video.DirectShow;
using System.IO;
using AForge.Imaging;
using AForge.Imaging.Filters;
using AForge.Video.VFW;
using AForge.Video.FFMPEG;
using System.Drawing.Imaging;
using AForge.Math;

namespace CameraDevice
{
public partial class Form1 : Form
{

private FilterInfoCollection VideoCaptureDevices;
private VideoCaptureDevice abcVideo;

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
VideoCaptureDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); //Liet ke thiet bi


foreach (FilterInfo VideoCaptureDevice in VideoCaptureDevices)
{
comboBox1.Items.Add(VideoCaptureDevice.Name);

}
comboBox1.SelectedIndex = 0;
abcVideo = new VideoCaptureDevice();

}

private void button1_Click(object sender, EventArgs e) //Start
{

if (abcVideo.IsRunning == true) abcVideo.Stop();
abcVideo = new VideoCaptureDevice(VideoCaptureDevices[comboBox1.SelectedIndex].MonikerString); //Khoi tao nguon video

abcVideo.NewFrame += new NewFrameEventHandler(abcVideo_NewFrame);// Thiet lap xu li newFrame
abcVideo.Start(); // start video
label1.Text = "Device running...";
timer1.Enabled = true;

}
void abcVideo_NewFrame(object sender, NewFrameEventArgs evenrArgs)
{
Bitmap video = (Bitmap)evenrArgs.Frame.Clone();
pictureBox1.Image = video;


}

private void button2_Click(object sender, EventArgs e) //stop
{
if (abcVideo.IsRunning)
{
abcVideo.Stop();

timer1.Enabled = false;
label1.Text = "Device stopped.";
}
}
private void timer1_Tick(object sender, EventArgs e)
{
label1.Text = "Device running..." + abcVideo.FramesReceived.ToString() + " FPS";
}


}

}

Now I want extract frame and convert frame from RGB into HSI. Expect people to help
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900