开发者

How to create Bitmap from (Compressed format) Bitmap Info Header and Scanlines in WPF?

开发者 https://www.devze.com 2022-12-20 09:03 出处:网络
I am using SampleGrabber in DirectShow on windows 7, I noticed that the Code supplied by Microsoft and many other providers dont work because the Bitmap data header reports that bitmap data is compres

I am using SampleGrabber in DirectShow on windows 7, I noticed that the Code supplied by Microsoft and many other providers dont work because the Bitmap data header reports that bitmap data is compressed, however the new Bitmap(width, height, stride, pixelfor开发者_StackOverflowmat, scanlines) doesnt have any parameters to specify that the buffer has compressed image. Certainly Bitmap will not identify that.

SampleGrabber's media type gives Bitmap Info Header, which has compression equal to something and the data received is less then the bytes indicated by bitmap info header.

Createing bitmap just creates garbage of all sort.

It appears that I have Bitmap Info Header and Scanlines, but there is no way to create bitmap from (Compressed format) Bitmap Info header and scanlines in WPF.

I tried using CreateDIBSection etc, but GDI+ doesnt work correctly in WPF, everything returning zero, I also tried to initialize GDI etc but no clue what to do now.


Configure the sample grabber's media type (sampleGrabber.SetMediaType) with one that has its subType set as RGB24.

Then the data will come as an uncompressed bitmap data in your BufferCB callback.

0

精彩评论

暂无评论...
验证码 换一张
取 消