locked
Converting from YUV to RGB24 - can you show me how? RRS feed

  • Question

  • I have modified the WMF MFCaptureToFile sample to save each IMFSample from my on board webcam to bitmap file, but they are coming out "psychedelically colorful".

    I understand this is because the subtype is YUY2, and that I need it to be RGB24.

    Can you show me the code to get this done?


    Sunday, April 8, 2012 2:10 PM

Answers

All replies

  • The color converter DSP can be used to transform samples from one color space to another.  The source reader cannot host an MFT, so you would have to create the transform yourself and process samples through it manually.  The MFDub sample on the MF blog does manual transform processing in transformapplier.cpp.

    If you could generate RGB32 bitmaps on the output side instead, the source reader should natively support converting to RGB32.

    Thursday, April 26, 2012 11:48 PM
  • You might also take a look at the MFCaptureD3D sample.  In order to display the frames with D3D, it converts them all to RGB32.  It supports input from RGB24, YUY2, NV12 and (unsurprisingly) RGB32.  Adding a writer to this code might be easier than applying a transform manually.
    Friday, April 27, 2012 9:48 PM