摄像头拍照录相代码,没摄像头测试,

 1   static class Program
 2     {
 3         /// <summary>
 4         /// 应用程序的主入口点。
 5         /// </summary>
 6         [STAThread]
 7         static void Main()
 8         {
 9             Application.EnableVisualStyles();
10             Application.SetCompatibleTextRenderingDefault(false);
11             Application.Run(new Form1());
12         }
13     }

Program Code

  1 using System;
  2 using System.Collections.Generic;
  3 using System.Linq;
  4 using System.Text;
  5 using System.Drawing ;
  6 using System.Drawing.Imaging;
  7 using System.Runtime .InteropServices ;
  8
  9 namespace CatchVIPH
 10 {
 11      class webcam
 12     {
 13          private const int WM_USER=0x400;
 14          private const int WS_CHILD=0x40000000;
 15          private const int WS_VISIBLE=0x10000000;
 16          private const int WM_CAP_START=WM_USER;
 17          private const int WM_CAP_STOP=WM_CAP_START + 68;
 18          private const int WM_CAP_DRIVER_CONNECT=WM_CAP_START + 10;
 19          private const int WM_CAP_DRIVER_DISCONNECT=WM_CAP_START + 11;
 20          private const int WM_CAP_SAVEDIB=WM_CAP_START + 25;
 21          private const int WM_CAP_GRAB_FRAME=WM_CAP_START + 60;
 22          private const int WM_CAP_SEQUENCE=WM_CAP_START + 62;
 23          private const int WM_CAP_FILE_SET_CAPTURE_FILEA=WM_CAP_START + 20;
 24          private const int WM_CAP_SEQUENCE_NOFILE=WM_CAP_START+ 63;
 25          private const int WM_CAP_SET_OVERLAY=WM_CAP_START+ 51;
 26          private const int WM_CAP_SET_PREVIEW=WM_CAP_START+ 50;
 27          private const int WM_CAP_SET_CALLBACK_VIDEOSTREAM=WM_CAP_START +6;
 28          private const int WM_CAP_SET_CALLBACK_ERROR=WM_CAP_START +2;
 29          private const int WM_CAP_SET_CALLBACK_STATUSA=WM_CAP_START +3;
 30          private const int WM_CAP_SET_CALLBACK_FRAME=WM_CAP_START +5;
 31          private const int WM_CAP_SET_SCALE=WM_CAP_START+ 53;
 32          private const int WM_CAP_SET_PREVIEWRATE=WM_CAP_START+ 52;
 33          private IntPtr hWndC;
 34          private bool bStat = false;
 35
 36          private IntPtr mControlPtr;
 37          private int mWidth;
 38          private int mHeight;
 39          private int mLeft;
 40          private int mTop;
 41          private string GrabImageName="";
 42          private string KinescopeName="";
 43
 44           /// <summary>
 45          /// 初始化摄像头
 46          /// </summary>
 47          /// <param name="handle">控件的句柄</param>
 48          /// <param name="left">开始显示的左边距</param>
 49          /// <param name="top">开始显示的上边距</param>
 50          /// <param name="width">要显示的宽度</param>
 51          /// <param name="height">要显示的长度</param>
 52          public webcam(IntPtr handle,int left,int top,int width,int height)
 53           {
 54              mControlPtr=handle;
 55              mWidth=width;
 56              mHeight=height;
 57              mLeft=left;
 58              mTop=top;
 59          }
 60          // #region "属性设置"
 61           /// <summary>
 62          /// 视频左边距
 63          /// </summary>
 64          public int Left
 65           {
 66               get {return mLeft;}
 67               set {mLeft=value;}
 68          }
 69
 70           /// <summary>
 71          /// 视频上边距
 72          /// </summary>
 73          public int Top
 74           {
 75               get {return mTop;}
 76               set {mTop=value;}
 77          }
 78
 79           /// <summary>
 80          /// 视频宽度
 81          /// </summary>
 82          public int Width
 83           {
 84               get {return mWidth;}
 85               set {mWidth=value;}
 86          }
 87
 88           /// <summary>
 89          /// 视频高度
 90          /// </summary>
 91          public int Height
 92           {
 93               get {return mHeight;}
 94               set {mHeight=value;}
 95          }
 96
 97           /// <summary>
 98          /// 抓图文件存放路径
 99          /// 例:d:\a.bmp
100          /// </summary>
101          public string grabImageName
102           {
103               get {return GrabImageName;}
104               set {GrabImageName=value;}
105          }
106
107
108           /// <summary>
109          /// 录像文件存放路径
110          /// 例:d:\a.avi
111          /// </summary>
112          public string kinescopeName
113           {
114               get {return KinescopeName;}
115               set {KinescopeName=value;}
116          }
117         // #endregion
118         [DllImport("TwiHikVision.dll",EntryPoint="GetFirstPic",CallingConvention=CallingConvention.Cdecl)]
119
120          public static extern string GetFirstPic(string videoFileName, string exportFilePath);
121
122          [DllImport("avicap32.dll")]
123          private static extern IntPtr capCreateCaptureWindowA(byte[] lpszWindowName,int dwStyle,int x,int y,int nWidth,int nHeight,IntPtr hWndParent,int nID);
124          [DllImport("avicap32.dll")]
125          public static extern bool capGetDriverDescriptionA(short wDriver, byte[] lpszName, int cbName, byte[] lpszVer, int cbVer);
126          [DllImport("avicap32.dll")]
127          private static extern int capGetVideoFormat(IntPtr hWnd,IntPtr psVideoFormat,int wSize );
128          [DllImport("User32.dll")]
129          private static extern bool SendMessage(IntPtr hWnd,int wMsg,int wParam,int iParm);
130
131           /// <summary>
132          /// 开始显示图像
133          /// </summary>
134          public void Start()
135           {
136              if(bStat)
137                  return;
138
139              bStat=true;
140              byte[] lpszName=new byte[100];
141
142              hWndC=capCreateCaptureWindowA(lpszName,WS_CHILD|WS_VISIBLE ,mLeft,mTop,mWidth,mHeight,mControlPtr,0);
143
144              if (hWndC.ToInt32()!=0)
145               {
146                  SendMessage(hWndC,WM_CAP_SET_CALLBACK_VIDEOSTREAM,0,0);
147                  SendMessage(hWndC,WM_CAP_SET_CALLBACK_ERROR,0,0);
148                  SendMessage(hWndC,WM_CAP_SET_CALLBACK_STATUSA,0,0);
149                  SendMessage(hWndC,WM_CAP_DRIVER_CONNECT,0,0);
150                  SendMessage(hWndC,WM_CAP_SET_SCALE,1,0);
151                  SendMessage(hWndC,WM_CAP_SET_PREVIEWRATE,66,0);
152                  SendMessage(hWndC,WM_CAP_SET_OVERLAY,1,0);
153                  SendMessage(hWndC,WM_CAP_SET_PREVIEW,1,0);
154              }
155              return;
156          }
157
158           /// <summary>
159          /// 停止
160          /// </summary>
161          public void Stop()
162           {
163              SendMessage(hWndC,WM_CAP_DRIVER_DISCONNECT,0,0);
164              bStat=false;
165          }
166
167           /// <summary>
168          /// 拍照
169          /// </summary>
170          /// <param name="path">要保存bmp文件的路径</param>
171          public void GrabImage()
172           {
173              IntPtr hBmp=Marshal.StringToHGlobalAnsi(GrabImageName);
174              SendMessage(hWndC,WM_CAP_SAVEDIB,0,hBmp.ToInt32());
175
176          }
177
178           /// <summary>
179          /// 录像
180          /// </summary>
181          /// <param name="path">要保存avi文件的路径</param>
182          public void Kinescope()
183           {
184              IntPtr hBmp=Marshal.StringToHGlobalAnsi(KinescopeName);
185              SendMessage(hWndC,WM_CAP_FILE_SET_CAPTURE_FILEA,0,hBmp.ToInt32());
186              SendMessage(hWndC,WM_CAP_SEQUENCE,0,0);
187          }
188
189           /// <summary>
190          /// 停止录像
191          /// </summary>
192          public void StopKinescope()
193           {
194              SendMessage(hWndC,WM_CAP_STOP,0,0);
195          }
196
197     }
198
199 }

webcam Code

  1 using System;
  2 using System.Collections.Generic;
  3 using System.ComponentModel;
  4 using System.Data;
  5 using System.Drawing;
  6 using System.Linq;
  7 using System.Text;
  8 using System.Windows.Forms;
  9 using System.Threading ;
 10 using System.IO;
 11
 12
 13 public partial class Form1 : Form
 14     {
 15         public Form1()
 16         {
 17             InitializeComponent();
 18         }
 19
 20         private webcam wcam = null;
 21
 22         private void Form1_Load(object sender, EventArgs e)
 23         {
 24             //start();
 25             //this.btnKinescopeSt.Enabled = false;
 26             ToolTip tooltip1 = new ToolTip();
 27             tooltip1.AutoPopDelay = 5000;
 28             tooltip1.InitialDelay = 1000;
 29             toolTip1.ReshowDelay = 500;
 30             toolTip1.ShowAlways = true;
 31             toolTip1.SetToolTip(this.txtPath, "请输入文件名称如 图片名称.bmp 视频名称.avi");
 32         }
 33
 34         public void start()
 35         {
 36             //以panel1显示视频内容
 37             wcam = new webcam(panel1.Handle, 0, 0, this.panel1.Width, this.panel1.Height);
 38             wcam.Start();
 39         }
 40         private void btnStar_Click(object sender, EventArgs e)
 41         {
 42             start();
 43             this.btnKinescopeSt.Enabled = false;
 44             wcam.Start();
 45
 46
 47         }
 48
 49         private void btnStop_Click(object sender, EventArgs e)
 50         {
 51             //wcam.Stop();
 52             this.Close();
 53              //btnKinescopeBg.Dispose();
 54         }
 55
 56         private void btnSnapPic_Click(object sender, EventArgs e)
 57         {
 58             //先填入图片名称和格式(\a.bmp)
 59            // this.txtPath.Text = @"(BMP)|*.BMP*.*";
 60             string PicName = this.txtPath.Text+".BMP";
 61
 62             if (PicName  == ""+".BMP")
 63             {
 64                 MessageBox.Show("必须填写图片名称");
 65                 return;
 66             }
 67             else if (File.Exists(PicName))
 68             {
 69                 MessageBox.Show("该图片名称已经存在,请换一个名称");
 70             }
 71             else
 72             {
 73
 74                 wcam.grabImageName = PicName ;
 75                 wcam.GrabImage();
 76                 MessageBox.Show("拍照成功");
 77             }
 78
 79         }
 80
 81
 82
 83         private void panel1_SizeChanged(object sender, EventArgs e)
 84         {
 85             wcam.Stop();
 86             wcam.Height = this.panel1.Height;
 87             wcam.Width = this.panel1.Width;
 88             wcam.Start();
 89         }
 90
 91         private delegate void delegateKinescope();
 92
 93         private void btnKinescopeBg_Click(object sender, EventArgs e)
 94         {
 95             //填入视频名称和格式(\a.avi)
 96             string KinName = this.txtPath.Text+ ".AVI";
 97             if (KinName == ""+".AVI")
 98             {
 99                 MessageBox.Show("必须填写视频名称");
100                 return;
101             }
102                 else if (File.Exists(KinName ))
103                 {
104                 MessageBox.Show("该视频名称已经存在,请换一个名称");
105                  }
106                     else
107                     {
108                         wcam.kinescopeName = KinName;
109                         delegateKinescope myK = new delegateKinescope(wcam.Kinescope);
110                         Thread threadKinescope = new Thread(new ThreadStart(myK));
111                         threadKinescope.Start();
112                         this.btnKinescopeBg.Enabled = false;
113                         this.btnKinescopeSt.Enabled = true;
114                     }
115         }
116         public void starKinescope()
117         {
118             delegateKinescope myK = new delegateKinescope (wcam.Kinescope );
119         }
120
121         private void btnKinescopeSt_Click(object sender, EventArgs e)
122         {
123             wcam .StopKinescope ();
124             this .btnKinescopeBg .Enabled = true;
125             this .btnKinescopeSt .Enabled = false;
126         }
127
128         private void txtPath_TextChanged(object sender, EventArgs e)
129         {
130
131         }
132
133         private void pictureBox1_Click(object sender, EventArgs e)
134         {
135
136         }
137
138         private void button1_Click(object sender, EventArgs e)
139         {
140
141             openFileDialog1.ShowDialog();
142             Bitmap p1 = new Bitmap(openFileDialog1.FileName);//建立一个bitmap对象
143             pictureBox1.Image = p1  ;
144
145         }
146
147         private void toolTip1_Popup(object sender, PopupEventArgs e)
148         {
149
150         }
151
152
153
154     }

Form1 Code

  1    partial class Form1
  2     {
  3         /// <summary>
  4         /// 必需的设计器变量。
  5         /// </summary>
  6         private System.ComponentModel.IContainer components = null;
  7
  8         /// <summary>
  9         /// 清理所有正在使用的资源。
 10         /// </summary>
 11         /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
 12         protected override void Dispose(bool disposing)
 13         {
 14             if (disposing && (components != null))
 15             {
 16                 components.Dispose();
 17             }
 18             base.Dispose(disposing);
 19         }
 20
 21         #region Windows 窗体设计器生成的代码
 22
 23         /// <summary>
 24         /// 设计器支持所需的方法 - 不要
 25         /// 使用代码编辑器修改此方法的内容。
 26         /// </summary>
 27         private void InitializeComponent()
 28         {
 29             this.components = new System.ComponentModel.Container();
 30             this.panel1 = new System.Windows.Forms.PictureBox();
 31             this.btnStar = new System.Windows.Forms.Button();
 32             this.btnStop = new System.Windows.Forms.Button();
 33             this.btnSnapPic = new System.Windows.Forms.Button();
 34             this.btnKinescopeBg = new System.Windows.Forms.Button();
 35             this.btnKinescopeSt = new System.Windows.Forms.Button();
 36             this.txtPath = new System.Windows.Forms.TextBox();
 37             this.pictureBox1 = new System.Windows.Forms.PictureBox();
 38             this.button1 = new System.Windows.Forms.Button();
 39             this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
 40             this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
 41             ((System.ComponentModel.ISupportInitialize)(this.panel1)).BeginInit();
 42             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
 43             this.SuspendLayout();
 44             //
 45             // panel1
 46             //
 47             this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
 48             this.panel1.Location = new System.Drawing.Point(0, 12);
 49             this.panel1.Name = "panel1";
 50             this.panel1.Size = new System.Drawing.Size(352, 238);
 51             this.panel1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
 52             this.panel1.TabIndex = 0;
 53             this.panel1.TabStop = false;
 54             this.panel1.SizeChanged += new System.EventHandler(this.panel1_SizeChanged);
 55             //
 56             // btnStar
 57             //
 58             this.btnStar.BackColor = System.Drawing.SystemColors.ButtonFace;
 59             this.btnStar.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
 60             this.btnStar.Location = new System.Drawing.Point(486, 12);
 61             this.btnStar.Name = "btnStar";
 62             this.btnStar.Size = new System.Drawing.Size(87, 30);
 63             this.btnStar.TabIndex = 1;
 64             this.btnStar.Text = "开启";
 65             this.btnStar.UseVisualStyleBackColor = false;
 66             this.btnStar.Click += new System.EventHandler(this.btnStar_Click);
 67             //
 68             // btnStop
 69             //
 70             this.btnStop.BackColor = System.Drawing.SystemColors.ButtonFace;
 71             this.btnStop.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
 72             this.btnStop.Location = new System.Drawing.Point(486, 306);
 73             this.btnStop.Name = "btnStop";
 74             this.btnStop.Size = new System.Drawing.Size(87, 31);
 75             this.btnStop.TabIndex = 2;
 76             this.btnStop.Text = "关闭";
 77             this.btnStop.UseVisualStyleBackColor = false;
 78             this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
 79             //
 80             // btnSnapPic
 81             //
 82             this.btnSnapPic.BackColor = System.Drawing.SystemColors.ButtonFace;
 83             this.btnSnapPic.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
 84             this.btnSnapPic.Location = new System.Drawing.Point(486, 187);
 85             this.btnSnapPic.Name = "btnSnapPic";
 86             this.btnSnapPic.Size = new System.Drawing.Size(87, 31);
 87             this.btnSnapPic.TabIndex = 3;
 88             this.btnSnapPic.Text = "拍照";
 89             this.btnSnapPic.UseVisualStyleBackColor = false;
 90             this.btnSnapPic.Click += new System.EventHandler(this.btnSnapPic_Click);
 91             //
 92             // btnKinescopeBg
 93             //
 94             this.btnKinescopeBg.BackColor = System.Drawing.SystemColors.ButtonFace;
 95             this.btnKinescopeBg.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
 96             this.btnKinescopeBg.Location = new System.Drawing.Point(486, 72);
 97             this.btnKinescopeBg.Name = "btnKinescopeBg";
 98             this.btnKinescopeBg.Size = new System.Drawing.Size(87, 30);
 99             this.btnKinescopeBg.TabIndex = 4;
100             this.btnKinescopeBg.Text = "开始录制";
101             this.btnKinescopeBg.UseVisualStyleBackColor = false;
102             this.btnKinescopeBg.Click += new System.EventHandler(this.btnKinescopeBg_Click);
103             //
104             // btnKinescopeSt
105             //
106             this.btnKinescopeSt.BackColor = System.Drawing.SystemColors.ButtonFace;
107             this.btnKinescopeSt.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
108             this.btnKinescopeSt.Location = new System.Drawing.Point(486, 128);
109             this.btnKinescopeSt.Name = "btnKinescopeSt";
110             this.btnKinescopeSt.Size = new System.Drawing.Size(87, 31);
111             this.btnKinescopeSt.TabIndex = 5;
112             this.btnKinescopeSt.Text = "停止录制";
113             this.btnKinescopeSt.UseVisualStyleBackColor = false;
114             this.btnKinescopeSt.Click += new System.EventHandler(this.btnKinescopeSt_Click);
115             //
116             // txtPath
117             //
118             this.txtPath.Location = new System.Drawing.Point(474, 489);
119             this.txtPath.Name = "txtPath";
120             this.txtPath.Size = new System.Drawing.Size(99, 21);
121             this.txtPath.TabIndex = 6;
122             this.txtPath.TextChanged += new System.EventHandler(this.txtPath_TextChanged);
123             //
124             // pictureBox1
125             //
126             this.pictureBox1.BackColor = System.Drawing.SystemColors.ActiveBorder;
127             this.pictureBox1.Location = new System.Drawing.Point(0, 256);
128             this.pictureBox1.Name = "pictureBox1";
129             this.pictureBox1.Size = new System.Drawing.Size(352, 260);
130             this.pictureBox1.TabIndex = 8;
131             this.pictureBox1.TabStop = false;
132             this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
133             //
134             // button1
135             //
136             this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
137             this.button1.Location = new System.Drawing.Point(486, 246);
138             this.button1.Name = "button1";
139             this.button1.Size = new System.Drawing.Size(87, 31);
140             this.button1.TabIndex = 9;
141             this.button1.Text = "查看";
142             this.button1.UseVisualStyleBackColor = true;
143             this.button1.Click += new System.EventHandler(this.button1_Click);
144             //
145             // openFileDialog1
146             //
147             this.openFileDialog1.FileName = "openFileDialog1";
148             //
149             // toolTip1
150             //
151             this.toolTip1.Popup += new System.Windows.Forms.PopupEventHandler(this.toolTip1_Popup);
152             //
153             // Form1
154             //
155             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
156             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
157             this.AutoSize = true;
158             this.BackColor = System.Drawing.SystemColors.ActiveCaption;
159             this.ClientSize = new System.Drawing.Size(624, 522);
160             this.Controls.Add(this.button1);
161             this.Controls.Add(this.pictureBox1);
162             this.Controls.Add(this.txtPath);
163             this.Controls.Add(this.btnKinescopeSt);
164             this.Controls.Add(this.btnKinescopeBg);
165             this.Controls.Add(this.btnSnapPic);
166             this.Controls.Add(this.btnStop);
167             this.Controls.Add(this.btnStar);
168             this.Controls.Add(this.panel1);
169             this.MaximizeBox = false;
170             this.MinimizeBox = false;
171             this.Name = "Form1";
172             this.Text = "CatchVIPH";
173             this.Load += new System.EventHandler(this.Form1_Load);
174             ((System.ComponentModel.ISupportInitialize)(this.panel1)).EndInit();
175             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
176             this.ResumeLayout(false);
177             this.PerformLayout();
178
179         }
180
181         #endregion
182
183         private System.Windows.Forms.PictureBox panel1;
184         private System.Windows.Forms.Button btnStar;
185         private System.Windows.Forms.Button btnStop;
186         private System.Windows.Forms.Button btnSnapPic;
187         private System.Windows.Forms.Button btnKinescopeBg;
188         private System.Windows.Forms.Button btnKinescopeSt;
189         private System.Windows.Forms.TextBox txtPath;
190         private System.Windows.Forms.PictureBox pictureBox1;
191         private System.Windows.Forms.Button button1;
192         private System.Windows.Forms.OpenFileDialog openFileDialog1;
193         private System.Windows.Forms.ToolTip toolTip1;
194     }

Form1Dispose Code

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <root>
 3
 4   <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
 5     <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
 6     <xsd:element name="root" msdata:IsDataSet="true">
 7       <xsd:complexType>
 8         <xsd:choice maxOccurs="unbounded">
 9           <xsd:element name="metadata">
10             <xsd:complexType>
11               <xsd:sequence>
12                 <xsd:element name="value" type="xsd:string" minOccurs="0" />
13               </xsd:sequence>
14               <xsd:attribute name="name" use="required" type="xsd:string" />
15               <xsd:attribute name="type" type="xsd:string" />
16               <xsd:attribute name="mimetype" type="xsd:string" />
17               <xsd:attribute ref="xml:space" />
18             </xsd:complexType>
19           </xsd:element>
20           <xsd:element name="assembly">
21             <xsd:complexType>
22               <xsd:attribute name="alias" type="xsd:string" />
23               <xsd:attribute name="name" type="xsd:string" />
24             </xsd:complexType>
25           </xsd:element>
26           <xsd:element name="data">
27             <xsd:complexType>
28               <xsd:sequence>
29                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
30                 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
31               </xsd:sequence>
32               <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
33               <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
34               <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
35               <xsd:attribute ref="xml:space" />
36             </xsd:complexType>
37           </xsd:element>
38           <xsd:element name="resheader">
39             <xsd:complexType>
40               <xsd:sequence>
41                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
42               </xsd:sequence>
43               <xsd:attribute name="name" type="xsd:string" use="required" />
44             </xsd:complexType>
45           </xsd:element>
46         </xsd:choice>
47       </xsd:complexType>
48     </xsd:element>
49   </xsd:schema>
50   <resheader name="resmimetype">
51     <value>text/microsoft-resx</value>
52   </resheader>
53   <resheader name="version">
54     <value>2.0</value>
55   </resheader>
56   <resheader name="reader">
57     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
58   </resheader>
59   <resheader name="writer">
60     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
61   </resheader>
62   <metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
63     <value>24, 17</value>
64   </metadata>
65   <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
66     <value>172, 17</value>
67   </metadata>
68 </root>

资源文件 Code

时间: 2024-08-30 04:28:18

摄像头拍照录相代码,没摄像头测试,的相关文章

利用html5调用本地摄像头拍照上传图片[转]

利用html5调用本地摄像头拍照上传图片 html5概念啥的就不废话了,不知道的 百度, 谷歌一堆..今天学了学html5中的Canvas结合新增的<video>标签来获取本地摄像头,在html5之前,要在浏览器获取本地摄像头只有通过插件(ActiveX,但是这种只有IE支持)或者是flash来获取(或许你没学过flash那就很坑爹了),在之后微软的silvertlight中也可以获取,但这些都比较麻烦,在html5的世界里,要获取本地摄像头,只要配合js就可以轻松获取.. 目前支持html5

VS2010开发MFC ActiveX,摄像头拍照上传Webservice(1)

最近工作项目,BS中需要用到摄像头拍照,需要存储本地,同时上传到服务器,尝试使用vc++做ActiveX来实现. 完全没有使用过vc,上网搜索各种知识,初步完成.在这里记录下有帮助的资料. 第一步:编写一个ActiveX 第二部:使用vfw.h开发摄像头拍照功能 第三步:裁剪,转换图并上传 转载出处:http://blog.csdn.net/longhuahaha/article/details/8556964 1.ActiveX的基本概念 ActiveX控件可以看作是一个极小的服务器应用程序,

控制摄像头拍照

现在的智能手机和平板电脑一般都会提供摄像头拍照功能.在Android中提供了专门用于处理摄像头相关事件的类,即android.hardware包中的Camera类.Camera类没有构造方法,可以通过其提供的open()方法打开摄像头.打开摄像头后,可以通过Camera.Parameters类处理摄像头的拍照参数.拍照参数设置完成后,可以调用startPreview()方法预览拍照画面,也可以调用takePicture()方法进行拍照.结束程序时,可以调用Camera类的stopPreview(

调用本地摄像头拍照(H5和画布)

关于H5 和 画布 调用本地摄像头拍照功能的实现 1.代码的实现(html部分) <input type="button" title="开启摄像头" value="开启摄像头" onclick="getMedia();" /><br /> <video height="120px" autoplay="autoplay"></video>

android调用摄像头拍照

调用手机摄像头拍照,获取拍照后的图片数据.以下代码是在activity中:     // 调用摄像头         Button b = (Button) findViewById(R.id.btn1);     b.setOnClickListener(new View.OnClickListener() {         @Override         public void onClick(View v) {             // Here we fire the inte

VS2010开发MFC ActiveX,摄像头拍照上传Webservice(2)

继续记录,第二步开发摄像头拍照功能. 使用vfw.h开发摄像头拍照功能,关于vfw网上有很多文章,很多代码可以参考 参考:http://blog.163.com/huangqiao_8/blog/static/33900492008017111847364/ Vedio for Windows 是WIN32 SDK 中多媒体编程SDK 的视频开发工具.在微软的Visual C ++中提供了Vedio for Windows 的头文件vfw.h 和库文件vfw32.lib. 在ActiveX中显示

在WPF中使用AForge.net控制摄像头拍照

原文:在WPF中使用AForge.net控制摄像头拍照 利用AForge.net控制摄像头拍照最方便的方法就是利用PictureBox显示摄像头画面,但在WPF中不能直接使用PictureBox.必须通过<WindowsFormsHost></WindowsFormsHost>来提供交换功能.其解决方法如下: 1.按照常规方法新建一个WPF应用程序: 2.添加引用 WindowsFormsIntegration  (与WinForm交互的支持) System.Windows.For

Ionic系列——调用摄像头拍照和选择图库照片功能的实现

1.需求描述 最近要做一个功能就是调用摄像头拍照,然后上传照片的功能,或者直接打开图库选择照片然后上传. 2.准备 ①.添加插件$cordovaCamera cordova plugin add cordova-plugin-camera ②.在controller中添加依赖 3.代码实现 $scope.takePhoto=function(){     var options = {                                                        

android: 调用摄像头拍照

很多应用程序都可能会使用到调用摄像头拍照的功能,比如说程序里需要上传一张图片 作为用户的头像,这时打开摄像头拍张照是最简单快捷的.下面就让我们通过一个例子来学 习一下,如何才能在应用程序里调用手机的摄像头进行拍照. 新建一个 ChoosePicTest 项目,然后修改 activity_main.xml 中的代码,如下所示: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" andro