Please note that as of October 24, 2014, we will be archiving some of the Nokia Developer discussion boards. The Nokia Asha and Nokia X sections will remain open for continued use. The "Windows Phone/Lumia" and "Other Platforms" sections will become read-only. For your Windows Phone development questions, we invite you to visit the Microsoft Developer Network (MSDN) discussion forums.

If this is your first visit, be sure to check out the FAQ. To start viewing messages, select the forum that you want to visit from the selection below.

I'm happy to see Nokia Imaging SDK now allow us to implement custom filters. It's so great, we don't need to do anything to use our custom filters. But how we can implement custom filters and how to use it, it's not clear. As far as I see the only documentation about that is in Real-time Filter Demo page. Real-time Filter Demo.

In Real-time Filter Demo, it shows a sample filter implemantation and there isn't any other information about implementing custom filters. Moreover, I want to know that;

how custom filters works

difference from predefined ones

performance

how to pass in/out parameters

Also It's really hard for me to find this sample, I'm searching it almost a week It'll be nice to see documentation about it under Nokia Imaging SDK library page.

As for passing parameters to custom filters I'd simply add them to the constructor of the derived class. As for performance comparisons, it seems that we're here simply surfacing a previously internal API so we shouldn't see different performance based on wether it's a built-in vs. a custom filter. Most likely the built-in filters will have been optimized better though. You can improve performance by going to C++ native code for the implementation, especially if you optimize your code to take advantage of the SIMD Neon intrinsics that are available there.

As for passing parameters to custom filters I'd simply add them to the constructor of the derived class. As for performance comparisons, it seems that we're here simply surfacing a previously internal API so we shouldn't see different performance based on wether it's a built-in vs. a custom filter. Most likely the built-in filters will have been optimized better though. You can improve performance by going to C++ native code for the implementation, especially if you optimize your code to take advantage of the SIMD Neon intrinsics that are available there.

Sorry for late reply, you are right about passing parameters and maybe performance, didn't tested yet. For performance I'll definitely go for C++.

Also I'm facing another problem for custom filters which is we can't use custom filter as built-in filters. For example;

With the code above, I can use IFilter > CustomFilter > IFilter
But to do that, I have to call RenderAsync() method two times and initialized another IImageProvider which is not efficent.

Maybe my approach is wrong, I'll try to find another approach. But I don't think we can use CustomFilters in the middle of built-in filters as I said as IFilter > CustomFilter > IFilter
I think SDK only allow IFilter > IFilter > CustomFilter sequence, CustomFilters must be at the end. Which implemantation is like below by the way

If you want develop your custom filter with C#, it's recommended to inherit from CustomEffectBase .
If you want develop with C++ it's recommended to implement ICustomEffect and use the DelegatingEffect to inteface you filter in an IFilter array.

But I don't think we can use CustomFilters in the middle of built-in filters as I said as IFilter > CustomFilter > IFilter

You can do it. SDk is designed for that . And share elements between different pipeline too

Warning :
1- Actually SDK doesn't provide a public tiles support. So when you use a custom filter, picture can be entirely decoded and you can have a lot of memory used.
2- I not checked but i understand a custom filter will create two pixels buffer in memory. The input and the output.
3- The input use the output size.

here i create one Image source and one FilterEffect but two renderer. The two renderer use same input :
source->effect->rendererLR
source->effect->rendererHR

Originally Posted by Engin Kırmacı

And final question, how to undo this "Filter > CustomFilter > IFilter" ?

When i works with the new SDK, i imagine that:
* Image Source as a box with an output
* FilterEffect and CustomFilter as a box with an input and an output.
* Renderer as a box with an input.
So i create a pipeline with output->input connexion. To undo something you need to remove a IFilter or reconnect an input to another output or recreate a pipeline part. For me, CustomFilter are beta code

here i create one Image source and one FilterEffect but two renderer. The two renderer use same input :
source->effect->rendererLR
source->effect->rendererHR

When i works with the new SDK, i imagine that:
* Image Source as a box with an output
* FilterEffect and CustomFilter as a box with an input and an output.
* Renderer as a box with an input.
So i create a pipeline with output->input connexion. To undo something you need to remove a IFilter or reconnect an input to another output or recreate a pipeline part. For me, CustomFilter are beta code

Thanks a lot. You explained very well and I understood the whole picture of custom filters.

I'll play it today. But as far as seen, CustomFilter will not provide my needs and enough performance for my usage. I'll still use CustomFilter but not foreach filters. Lets say, for basic pixel manipulations there will be SimpleFilters derived from CustomEffectBase. I mean it'll be like "FilterEffect" I already did something for Beta SDK

Another problem for custom filter, we can't change output image size inside custom filters. We have to use ReframingFilter after our custom filter for that. For example, I need to get Quadrilateral object from image. Lets says image is 800x600 and I want object to be 300x300. My filter get object pixels to "targetPixelRegion". But "targetPixelRegion" dimension is fixed to 800x600. So after custom filter I have to use ReframingFilter. As shown in the picture.

My suggestion is if we use built-in filters inside custom filters before and after "OnProcess", will be realy helpful and allows us to create more advance custom filters.

I see another things. If your customfilter is an input of a renderer, the input and the output size will be the size of the rendereing

We have to consider this. Also built-in filters (tested with ReframingFilter) is an input of renderer resulting same as custom filters. I think the problem was caused, becuase of we use target image with renderer. I tested JpegRenderer which doesn't have target image, and saved it directly to isolatedstorage, size of saved image is correct.