draco1023 / aforge

Automatically exported from code.google.com/p/aforge
Other
0 stars 0 forks source link

video capture crash #73

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Try to replicate the example in "VideoCaptureDevice Class" documentation;
2. Copy and paste code in C# (please refer to the attach file "code.gif"); 
3. Compile (F6) and Start (F5).

What is the expected output? What do you see instead?

Video frame should be put inside a pictureBox.
It works as expected for few seconds then application crash and I got an
error (please refer to the attach file "error.gif").

Please use labels and text to provide additional information.

WinXP Pro SP2, C# 2008 Express Ed., DirectX 9.0c, AForge.NET 1.7.0.
Webcam is correctly enumerated after FilterInfoCollection.

Original issue reported on code.google.com by paladino...@gmail.com on 4 Oct 2008 at 11:02

Attachments:

GoogleCodeExporter commented 9 years ago
When you work with video sources implementing (IVideoSource) interface, you 
need to 
clone image, when you do processing of NewFrame event. All video sources 
dispose 
original image, so you can not work with image, which was passed to the event 
handler, but you need to make a copy.

In your code make a clone, before assigning picture to Picture Box.

Documentation for all video sources was already updated, so it will be clear 
from 
docs of the new version.

Also 2.0 version of the framework will provide special control, which could be 
used 
for playing video source.

Original comment by andrew.k...@gmail.com on 4 Oct 2008 at 11:09