本帖最后由 hetengfei_ 于 2012-01-20 21:31:28 编辑

解决方案 »

  1.   

    this.groupBox1 = new System.Windows.Forms.GroupBox();
    this.button4 = new System.Windows.Forms.Button();
    this.button3 = new System.Windows.Forms.Button();
    this.button2 = new System.Windows.Forms.Button();
    this.button1 = new System.Windows.Forms.Button();
    this.groupBox2 = new System.Windows.Forms.GroupBox();
    this.panel1 = new System.Windows.Forms.Panel();
    this.groupBox1.SuspendLayout();
    this.groupBox2.SuspendLayout();
    this.SuspendLayout();
    // 
    // groupBox1
    // 
    this.groupBox1.Controls.Add(this.button7);
    this.groupBox1.Controls.Add(this.button6);
    this.groupBox1.Controls.Add(this.button5);
    this.groupBox1.Controls.Add(this.button4);
    this.groupBox1.Controls.Add(this.button3);
    this.groupBox1.Controls.Add(this.button2);
    this.groupBox1.Controls.Add(this.button1);
    this.groupBox1.Location = new System.Drawing.Point(580, 1);
    this.groupBox1.Name = "groupBox1";
    this.groupBox1.Size = new System.Drawing.Size(93, 404);
    this.groupBox1.TabIndex = 8;
    this.groupBox1.TabStop = false;
    this.groupBox1.Text = "操作";
    // 
    // button4
    // 
    this.button4.Location = new System.Drawing.Point(6, 122);
    this.button4.Name = "button4";
    this.button4.Size = new System.Drawing.Size(79, 27);
    this.button4.TabIndex = 11;
    this.button4.Text = "button4";
    this.button4.UseVisualStyleBackColor = true;
    this.button4.Click += new System.EventHandler(this.button4_Click);
    // 
    // button3
    // 
    this.button3.Location = new System.Drawing.Point(6, 88);
    this.button3.Name = "button3";
    this.button3.Size = new System.Drawing.Size(79, 27);
    this.button3.TabIndex = 10;
    this.button3.Text = "拍照保存";
    this.button3.UseVisualStyleBackColor = true;
    this.button3.Click += new System.EventHandler(this.button3_Click);
    // 
    // button2
    // 
    this.button2.Location = new System.Drawing.Point(6, 54);
    this.button2.Name = "button2";
    this.button2.Size = new System.Drawing.Size(79, 27);
    this.button2.TabIndex = 9;
    this.button2.Text = "关闭摄像头";
    this.button2.UseVisualStyleBackColor = true;
    this.button2.Click += new System.EventHandler(this.button2_Click);
    // 
    // button1
    // 
    this.button1.Location = new System.Drawing.Point(6, 20);
    this.button1.Name = "button1";
    this.button1.Size = new System.Drawing.Size(79, 27);
    this.button1.TabIndex = 8;
    this.button1.Text = "显示摄像头";
    this.button1.UseVisualStyleBackColor = true;
    this.button1.Click += new System.EventHandler(this.button1_Click);
    // 
    // groupBox2
    // 
    this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
        | System.Windows.Forms.AnchorStyles.Left)
        | System.Windows.Forms.AnchorStyles.Right)));
    this.groupBox2.Controls.Add(this.panel1);
    this.groupBox2.Location = new System.Drawing.Point(4, 1);
    this.groupBox2.Name = "groupBox2";
    this.groupBox2.Size = new System.Drawing.Size(561, 404);
    this.groupBox2.TabIndex = 9;
    this.groupBox2.TabStop = false;
    this.groupBox2.Text = "图像";
    // 
    // panel1
    // 
    this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
    this.panel1.Location = new System.Drawing.Point(8, 16);
    this.panel1.Name = "panel1";
    this.panel1.Size = new System.Drawing.Size(562, 388);
    this.panel1.TabIndex = 2;
    // 
    // Form1
    // 
    this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    this.ClientSize = new System.Drawing.Size(685, 438);
    this.Controls.Add(this.groupBox2);
    this.Controls.Add(this.groupBox1);
    this.Name = "Form1";
    this.Text = "Form1";
    this.Load += new System.EventHandler(this.Form1_Load);
    this.groupBox1.ResumeLayout(false);
    this.groupBox2.ResumeLayout(false);
    this.ResumeLayout(false);
      

  2.   

    我做视频监控程序都是引用别人写好的类库,不关心内部怎么实现。 [DllImport("***.dll")]
    是引用外部dll用的比如
     [DllImport("avicap32.dll")]
    //这个function 干什么 用?
            private static extern IntPtr capCreateCaptureWindowA(byte[] lpszWindowName, int dwStyle, 
    下面这个函数就是avicap32.dll中定义的。具体代码你看不到,用就可以了。。可能给你每个参数的意思的说明文档。
      

  3.   

    一般带extern关键字的函数都和DllImport一起用。。
      

  4.   

    我上传了资源dshow或才你搜一下也可以搜到。有截图,录象等。
      

  5.   

    LZ的这些个代码是已经过时技术 MS建议不要使用。因为在98年就已被DirectShow 代替。
      

  6.   

    我也遇到此类问题还是找找开源库吧,比如DirectShow.net,DirectShowLib,AForge.NET等等的...
      

  7.   


    AForge.NET 是一个开源的 库 内容丰富
     AForge.Imaging -一些日常的图像处理和过滤器  AForge.Vision -计算机视觉应用类库  AForge.Neuro -神经网络计算库  AForge.Genetic -进化算法编程库  AForge.MachineLearning -机器学习类库  AForge.Robotics -提供一些机器学习的工具类库  AForge.Video -一系列的视频处理类库(很方便)
    基于Aforge的物体运动识别-入门篇
      

  8.   

    太感谢了!
      原来还有封装好的类库!
    但是: 一只摄像头,只能取画面,只能是二维的,没有立体的。
     还是想用二只摄像头好点,两个摄像头可以计算距离啊,是三维,哈哈!
      但里面的好象没有 介绍两只摄像头的。 好象在电脑插入两只USB摄像头,如何同时取得拍照的图片的 对象Image ? 
      

  9.   

    我知道,摄像头比较难识别手的color,每个人的手color 不同啊,
    一个人的手不同时期的color也不同啊。
      不同的灯光下,的一个人的手的color 也不同啊。
     晕死了!
      

  10.   

    AForge.NET 也是支持同时多个摄像头的,只是代码逻辑可能要自己写了,库的zip包里面好像有一个
    双摄像头的...具体还不清楚
    是啊,一年前我也玩过AForge.NET 当时似乎也没这么多东西,现在确实成长了,变得强大了,我正好也是今天一大早才发现的...