Exception on BitmapFrame.Create (bug in WPF framework?)

后端 未结 4 1829
借酒劲吻你
借酒劲吻你 2021-01-11 16:17

I implemented a C# application that recevies frame RGB at framerate of 30fps.

The event of frame arrive is managed with this code:

void client_ColorFra         


        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-11 16:53

    I hope my answer help you,

    I had using same code, but BitmapFrame.cs (at PresetationCore.dll) occur Exception when we are using BitmapFrame.Create(source).

    So, I just Using other create function below one, which is Inner function of BitmpaFrame.Create,

    BitmapFrame.cs
         public static BitmapFrame Create(
            BitmapSource source,
            BitmapSource thumbnail,
            BitmapMetadata metadata,
            ReadOnlyCollection colorContexts
            )
    

    we can get same result BitmapFrame.Create(source, null, null, null).

    • in your case, enc.Frames.Add(BitmapImage.Create(bitmap, null, null, null));

    thanks.

提交回复
热议问题