0

This is my code and my goal is to make the cloned images(Bitmap) opacity adjustable using the color matrix however, the tutorial on YouTube is insufficient for me hence, I need help on my project. Thank you very much in advance for helping me! If there are questions regarding on my project, just comment in and I will try to reply as soon as possible guys.

This is my code:

 private FilterInfoCollection CaptureDevices;
    private VideoCaptureDevice videoSource;
    private void Form1_Load(object sender, EventArgs e)
    {
        {
            CaptureDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            foreach (FilterInfo Device in CaptureDevices)
            {
                comboBox1.Items.Add(Device.Name);
                comboBox2.Items.Add(Device.Name);
            }
            comboBox1.SelectedIndex = 0;
            videoSource = new VideoCaptureDevice();
            comboBox2.SelectedIndex = 0;
            videoSource = new VideoCaptureDevice();
        }
    }
    private void s1_Click(object sender, EventArgs e)
    {
        videoSource = new VideoCaptureDevice(CaptureDevices[comboBox1.SelectedIndex].MonikerString);
        videoSource.NewFrame += new NewFrameEventHandler(VideoSource_NewFrame);
        videoSource.Start();
    }
    private void VideoSource_NewFrame(object sender, NewFrameEventArgs eventArgs)
    {
        pictureBox1.Image = (Bitmap)eventArgs.Frame.Clone();
    }

    private void s2_Click(object sender, EventArgs e)
    {
        videoSource = new VideoCaptureDevice(CaptureDevices[comboBox2.SelectedIndex].MonikerString);
        videoSource.NewFrame += new NewFrameEventHandler(VideoSource_NewFrames);
        videoSource.Start();
    }
    private void VideoSource_NewFrames(object sender, NewFrameEventArgs eventArgs)
    {
        pictureBox2.Image = (Bitmap)eventArgs.Frame.Clone();
    }

    private void r1_Click(object sender, EventArgs e)
    {
        videoSource.Stop();
        pictureBox1.Image = null;
        pictureBox1.Invalidate();
        pictureBox3.Image = null;
        pictureBox3.Invalidate();
    }

    private void r2_Click(object sender, EventArgs e)
    {
        videoSource.Stop();
        pictureBox2.Image = null;
        pictureBox2.Invalidate();
        pictureBox4.Image = null;
        pictureBox4.Invalidate();
    }

    private void c1_Click(object sender, EventArgs e)
    {
        pictureBox3.Image = (Bitmap)pictureBox1.Image.Clone();
    }

    private void c2_Click(object sender, EventArgs e)
    {
        pictureBox4.Image = (Bitmap)pictureBox2.Image.Clone();
    }
  • [How to apply a fade transition effect to PictureBox Images using a Timer?](https://stackoverflow.com/a/61293719/7444103) -- `SetOpacity()` is defined as an extension method (to the Bitmap class) – Jimi Mar 15 '22 at 15:41
  • I'll check it out : D – TeshimaSan Mar 15 '22 at 15:43

0 Answers0