我試圖將代碼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