使用c#保存来自网络摄像头Emgucv的视频

时间:2015-10-06 09:45:59

标签: c# emgucv

我正在使用emgu cv和c#进行图像处理。我希望将我的流媒体网络摄像头视频存储在一个文件中。我还想在文件中存储20帧/秒。我怎么能这样做?这是我的代码。

   namespace CamApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        QuBIC.MachineConsciousness.OPCCA.OPCCR occprWnd;//=null;
        Capture capture;// = default(Capture);

        private void button1_Click(object sender, EventArgs e)
        {

            capture = new Capture(0);
            Control.CheckForIllegalCrossThreadCalls = false;
            System.Threading.Thread t = new System.Threading.Thread(Grab);
            t.Start();
            }

        private void Grab() 
        {
            Bitmap bmp,bmp1;
            do 
            {
                bmp = capture.QueryFrame().ToBitmap();
                bmp1 = bmp;
                pictureBox1.Image = bmp;

                int i = 0;


                occprWnd.SetCamImage((Bitmap)bmp.Clone());
                bmp.Save(@"E:\Project\Myapp\CamApp\images\img" + i + ".jpg");
                i++;

            }
            while (true);
        }
        private void button2_Click(object sender, EventArgs e)
        {
            occprWnd = new QuBIC.MachineConsciousness.OPCCA.OPCCR();
            occprWnd.Show(this);
        }
    }
}

0 个答案:

没有答案