我试图将代码http://sites.google.com/site/webcamlibrarydotnet/winfrom-and-csharp-sample-code-and-download从图片框更改为图片或位图,因为我不想显示任何图像或计划来显示,我只想要将图像输出到文件。PictureBox到位图或图像?
我试图在e.WebCamImage
改变从PictureBox _FrameImage
的webcam.cs到Bitmap _FrameImage
和PictureBox ImageControl
到Bitmap ImageControl
和铸造(位图)以及改变它的主要形式:
private void bWebcam_Click(object sender, EventArgs e)
{
WebCam webcam = new WebCam();
Bitmap image = null;
webcam.InitializeWebCam(ref image);
webcam.Start();
webcam.Stop();
FileStream fstream = new FileStream("testWebcam.jpg", FileMode.Create);
image.Save(fstream, System.Drawing.Imaging.ImageFormat.Jpeg);
fstream.Close();
}
- 不高兴它似乎不工作,所以 我怎么能将它从图片 框更改为位图或图像或类似 保存到一个文件或 保存到文件直接?
我使用的源代码是: http://sites.google.com/site/webcamlibrarydotnet/winfrom-and-csharp-sample-code-and-download
如果您搜索SO,则先前先询问过Bitmap to Image问题 – 2011-04-08 14:01:25
为什么不调用image.Save(“testWebcam.jpg”)? – 2011-04-08 14:01:55
@Tony它不是位图的图像它是PictureBox的任何一个2. – Guapo 2011-04-08 14:03:17