【发布时间】:2011-08-01 13:10:07
【问题描述】:
我正在尝试将代码 http://sites.google.com/site/webcamlibrarydotnet/winfrom-and-csharp-sample-code-and-download 从图片框更改为图像或位图,因为我不想显示任何图像或计划显示,我想要的只是它将图像输出到文件。
我尝试将 webcam.cs 从PictureBox _FrameImage 更改为Bitmap _FrameImage 和PictureBox ImageControl 更改为Bitmap ImageControl 并在e.WebCamImage 投射(位图)
以及在主窗体上更改它:
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 问题之前已经被问过
-
为什么你不只调用 image.Save("testWebcam.jpg") ?
-
@Tony 它不是 Bitmap to Image 它是 PictureBox 到 2 之一。
-
@Anton 问题是图像始终为空,因此我对源代码所做的更改不起作用,这就是我寻求帮助的原因;)
标签: c# image picturebox