0
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;

namespace Sample
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private FilterInfoCollection CaptureDevice;
        private VideoCaptureDevice FinalFrame;


        private void Form1_Load(object sender, EventArgs e)
        {
            CaptureDevice = new FilterInfoCollection(FilterCategory.AudioCompressorCategory);
            foreach (FilterInfo Device in CaptureDevice)
            {
                comboBox1.Items.Add(Device.Name);

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

        private void button1_Click(object sender, EventArgs e)
        {
            FinalFrame = new VideoCaptureDevice(CaptureDevice[comboBox1.SelectedIndex].MonikerString);
            FinalFrame.NewFrame+= new NewFrameEventHandler (FinalFrame_NewFrame);
            FinalFrame.Start();
        }

        private void FinalFrame_NewFrame(object sender, NewFrameEventArgs eventArgs)
        {
            pictureBox1.Image = (Bitmap)eventArgs.Frame.Clone();
        }


    }
}

This code is used to getting for open my web camera, this code is worked properly. I want to add a little code part to convert REAL TIME VIDEO into GRAY-SCALE VIDEO, if anyone knows the algorithm, Please help me to do that.

Dinusha
  • 11
  • 2
  • try this http://fewtutorials.bravesites.com/entries/emgu-cv-c/level-1---lets-make-a-camera-application – Anirudha Gupta Jul 10 '18 at 06:56
  • Do you wish to save the gray-scale video somehow? – PepitoSh Jul 10 '18 at 07:00
  • @Adrian hey i referred your link, that is very help me to improve my application and i am really appreciated but i didn't get any point to convert the real time video frame to gray-scale. – Dinusha Jul 10 '18 at 08:40
  • @PepitoSh No i don't want to save it. the important part is to get the gray-scale(black and white) video in real-time from the webcam. above code has worked properly, i need to get the gray-scale frame instead of original frame(RGB). – Dinusha Jul 10 '18 at 08:46
  • https://stackoverflow.com/questions/2265910/convert-an-image-to-grayscale – PepitoSh Jul 10 '18 at 08:52
  • @PepitoSh yeah i tried it before, it's worked. but i actually wanted to filter real time videos(live video) to gray-scale videos. – Dinusha Jul 10 '18 at 09:13
  • @Dinusha see this https://stackoverflow.com/questions/2950392/conversion-to-grayscale-using-emgucv-in-c-sharp for converting to greyscale – Anirudha Gupta Jul 10 '18 at 09:23
  • I don't see your problem. What is your definition of real time video in your book? You display the each frame as they are captured from the camera. Those are the frames of the live video. – PepitoSh Jul 10 '18 at 10:04

0 Answers0