Bonjour,
J'ai besoin d'enregistrer une image à partir d'un flux video de la webcam, mon problème c'est que la fonction image.save() ne fonctionne pas, avant il y a avait l'erreur “A generic error occurred in GDI+”, j'ai réussi à corriger l'erreur mais l'image n'est toujours pas enregistrée.
Merci pour votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 void FinalVideo_newFrame(object Sender, NewFrameEventArgs eventArgs) { video = (Bitmap)eventArgs.Frame.Clone(); pictureBox1.Image = video; } private void button2_Click(object sender, EventArgs e) { Bitmap current = (Bitmap)video.Clone(); string filepath = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); string[] part; try { using (Bitmap tempImage = new Bitmap(current)) { tempImage.Save(filepath, System.Drawing.Imaging.ImageFormat.Bmp); } } catch (Exception ee) { Debug.WriteLine("DEBUG::LoadImages()::Error attempting to create image::" + ee.Message); } string fileName = System.IO.Path.Combine(filepath, @"name.bmp"); pictureBox2.Image = current; current.Dispose(); }
Partager