Click here to Skip to main content
15,905,148 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have check camera connect to pc very good.
C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using OpenCVDotNet;

namespace WindowsApplication6
{
    public partial class Form1 : Form
    {
        private CVCapture capture;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            capture = new CVCapture(0);// when  debug i see signal light camera
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            using (CVImage nextFrame = capture.QueryFrame())// why nextFrame set null? 

                {
                    if (nextFrame == null) capture.Restart();
                    selectPictureBox1.Image = nextFrame.ToBitmap();
	            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Enabled = !(timer1.Enabled);
        }
    }
}


// I click mouse on "My Computer" icon. Then I double click on "USB Video Device #2". I see my picture. Its mean my camera has work.
My problem why nextFrame set null value.???
please help me! Thanks!
Posted
Updated 2-Nov-11 19:09pm
v2
Comments
Md. Rashim Uddin 3-Nov-11 4:23am    
Coz it does not get the file handle of the file.

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