Tools

Namespaces

Variants

Views

Actions

Search

Contents

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Introduction

After Nokia Imaging SDK graduates from beta, custom filter introduced. This is most exciting feature, that allow us to create our own filters.
In this article, I'll be explaining how to implement custom filters for different purposes by comparing differences in implemantation that described in Core Concepts document.

Note: IsInPlace property is true here. Which means sourcePixel and targetPixel is same array. Documentation says that it's more efficient. But you have to be careful if you want to process pixel and don't want to change source pixel.

Simple Custom Filter

ThresholdFilter is one of the sample for this type of filter. It's the same implementation as described here

Note: IsInPlace property didn't set here. Default value of it is false. Which means sourcePixel, targetPixel is different array and you have to get pixel from sourcePixel, process it and set to targetPixel. Also note that If you don't set targetPixel, you'll see black image.

Complex Custom Filter

PixelInterpolation is one of the sample for this type of filter. This filter pixelates image without changing the image size. It divides to image to rectangles like table and get top left pixel of each cell. Then changes every pixels in cell to corner.
For that purpose, iteration every pixels with ForEachRow is not efficient. First of all, use following to get width and height of an image.

Note: ForEachRow method in PixelRegion class used for iterate over the pixels consecutively. If you want to iterate every pixels consecutively, don't use for loop, ForEachRow method is the most efficient way. Unless you want to iterate some pixels, not all of them or multiple iteration for each pixel as shown in the code above, use for loop.

Note: IsInPlace property didn't set here. Default value of it is false. Which means sourcePixel, targetPixel is different array and you have to get pixel from sourcePixel, process it and set to targetPixel. Also note that If you don't set targetPixel, you'll see black image.

Use Complex Custom Filter without my Framework

As you seen in the image, result will be smaller than input image. But custom filter implementation doesn't allow us to change output size. I solved that problem in my framework by using IPreProcess and IPostProcess interfaces.

Summary

As you've seen in article, it's easy to implement your own custom filters. I implemented some filters which are used for image processing and I'll constantly adding new filters for that purpose. If you request me a custom filter implementation, please add a comment. I'll try my best and also you can contribute to project, follow github page.