×
Namespaces

Variants
Actions
Revision as of 11:08, 28 February 2014 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Magic Edge Pen Filter Recipe - Navibyte (Nokia Imaging SDK)

From Nokia Developer Wiki
Jump to: navigation, search

This recipe mimics a Sobel operator edge filter using Nokia Imaging SDK inbuilt filters.

See Also
Article Metadata
Tested with
SDK: Windows Phone 8.0 SDK
Devices(s): Nokia Lumia 920
Dependencies: Nokia Imaging SDK 1.0
Article
Created: hamishwillee (27 Feb 2014)
Last edited: hamishwillee (28 Feb 2014)

Contents

Introduction

This article shows how to mimic a Sobel operator edge filter using Nokia Imaging SDK inbuilt filters. The image is first turned to grayscale, then Magic Pen is applied and finally contrast is added to make edges more crisp and to remove ambient noise.

Note.pngNote: This filter was originally created by navibyte in the article Combining imaging filters to create new real-time camera effects#Magic Edge Pen.

The article includes the recipe source code, instructions on how it can be used and tested, performance measurements and a gallery.

Magic Edge Pen


Source code

The code for creating the effect, the source, renderer and target is described in #How to use the filter and Core concepts (Nokia Developer Library). The fragment below shows only the "recipe-specific" code for adding the filters to the List<IFilter>.

var filters = new List<IFilter>();
//Magic Edge Pen, by Navibyte
filters.Add(new GrayscaleFilter());
filters.Add(new MagicPenFilter());
filters.Add(new ContrastFilter(0.6));


How to use the filter

This recipe uses only filters based on IFilter. These are combined by simply adding them to an IFilter list, which is then passed to a FilterEffect along with the source. The code fragment below shows the general strategy (this is explained in more detail in Nokia Developer SDK - Core concepts).

var filters = new List<IFilter>();
//The recipe filters are added here
...
...
 
using (var source = new StreamImageSource(stream))
using (var filterEffect = new FilterEffect(source) { Filters = filters })
using (var renderer = new WriteableBitmapRenderer(filterEffect, writeableBitmap))
{
await renderer.RenderAsync();
}


Testing the filter

The easiest way to test the recipes is to add them to the Test Apps for Viewing Custom Filters (Nokia Imaging SDK) (a fork of the Real Time Filter Demo).

License

The code has been released with the standard MIT License.

Performance

This section lists the approximate frame rate range (in frames-per-second) obtained by using the recipe in the Test framework.

Device FPS (Frames Per Second)
Lumia 1020 7-8 FPS
- -

Gallery

This page was last modified on 28 February 2014, at 11:08.
46 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×