简体   繁体   中英

How to apply color effects on a camera based app for windows phone 8.1 WinRT?

I am developing a magnifying app on windows phone 8.1 WinRT for visual impaired users and in the magnification page (camera based),i want to apply color effects and contrast for more accessibility (black in white , yellow in blue , yellow in black , black in white ,... )

http://www.1800pocketpc.com/wp-content/uploads/2014/10/Microsoft-Pocket-Magnifier-700x437.jpg

Do anyone know how to deal with that ?

I believe the easiest way for you to do it is using the Lumia Imaging SDK ( https://msdn.microsoft.com/en-us/library/dn859593.aspx ) which works for WinRT platform. There is for example ContrastFilter class which would probably suit you very well. Here's how to use it:

using (var filterEffect = new FilterEffect(source))
{
    // Initialize the filter and add the filter to the FilterEffect collection
    var filter = new ContrastFilter(0.5);

    filterEffect.Filters = new IFilter[] { filter };

    // Create a target where the filtered image will be rendered to
    var target = new WriteableBitmap(width, height);

    // Create a new renderer which outputs WriteableBitmaps
    using (var renderer = new WriteableBitmapRenderer(filterEffect, target))
    {
        // Render the image with the filter(s)
        await renderer.RenderAsync();

        // Set the output image to Image control as a source
        ImageControl.Source = target;
    }

    await SaveEffectAsync(filterEffect, "ContrastFilter.jpg", outputImageSize);
}

And before anyone says that it's a copy/paste from the sdk docs - it's ok as I've written that sample to the original docs :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM