How do I use Accord.Video.VFM with System.Drawing.Bitmap?

128 views Asked by At

I'm building an WPF App on Visual Studio trying to capture and display video from a webcam and record it. So far I can do the first part, however I'm stuck using Accord.Video.VFM to record the output of the camera.

when using the provided AddFrame() method I get: The type 'Bitmap' is defined in an assembly that is not referenced. You must add a reference to assembly 'CoreCompat.System.Drawing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.

However I do have System.Drawing.Common added via Nuget, and as far as I know CoreCompat.System.Drawing is deprecated and superseeded by System.Drawing.Common. So what might be the problem?

I've tried to test it out with a minimalized example by using the sample cove provided at: http://accord-framework.net/docs/html/T_Accord_Video_VFW_AVIWriter.htm To the same effect.

Sample code:

// instantiate AVI writer, use WMV3 codec
AVIWriter writer = new AVIWriter( "wmv3" );
// create new AVI file and open it
writer.Open( "test.avi", 320, 240 );
// create frame image
Bitmap image = new Bitmap( 320, 240 );

for ( int i = 0; i < 240; i++ )
{
    // update image
    image.SetPixel( i, i, Color.Red );
    // add the image as a new frame of video file
    writer.AddFrame( image );
}
writer.Close( );
0

There are 0 answers