How to add grayscale effect to a live preview camera capture?


  • Hello All.

    How can I take the live stream coming from a webcam which is displaying live on in my metro app, allow the user to click a "apply grayscale" button, and then apply a grayscale effect onto the live webcam preview?

    I am starting with the previewing code from the MediaCaptureCPP project.  This will display a box on the screen which shows the live camera feed.

    The code to do this is:






    I have then put a button on the screen which says "Apply Grayscale Effect."  The code for this is just a button handler:

    void SampleApp::MainPage::GrayscaleBtn_click(...)







    I'm using the same GrayscaleTransform.dll file used in the MediaPluginsCPP project.

    Shouldn't the live feed change to grayscale when I click the button?  What am I missing?  Any help will be greatly appreciated!!!

    Wednesday, February 15, 2012 1:21 AM


  • Hello Seek,

    You cannot add an effect while the topology is in a "running" or "paused" state. You must make sure that the topology is stopped before adding the effect.

    I hope this helps,


    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Wednesday, February 15, 2012 10:04 PM