×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    22

    Imaging SDK 1.0 Feedback Competition: Engin Kırmacı: Custom filter documentation!

    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.

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    429

    Re: Imaging SDK 1.0 Feedback Competition: Engin Kırmacı: Custom filter documentation!

    I'm pretty sure we'll get some more documentation as part of the Imaging Wiki competition. As for the implementation of a custom filter using Version 1.0 of the SDK you can have a look here:
    http://developer.nokia.com/Resources...stomEffectBase

    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.

  3. #3
    Registered User
    Join Date
    Mar 2013
    Posts
    22

    Re: Imaging SDK 1.0 Feedback Competition: Engin Kırmacı: Custom filter documentation!

    Quote Originally Posted by SB Dev View Post
    I'm pretty sure we'll get some more documentation as part of the Imaging Wiki competition. As for the implementation of a custom filter using Version 1.0 of the SDK you can have a look here:
    http://developer.nokia.com/Resources...stomEffectBase

    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;

    Code:
                var Effects = new FilterEffect(source);
                Effects.Filters = new IFilter[]
                {
                    new AntiqueFilter(),
                    new RotationFilter(35.0), 
                    new SomeCustomFilter() //not allowed
                };
    Because CustomEffectBase didn't derive from IFilter. It derives from IImageProvider. So It's not a good solution if we want to use custom filter with built-in. I did something like that;

    Code:
            private StreamImageSource source = null;
            private WriteableBitmapRenderer renderer = null;
            public WriteableBitmap outputBitmap;
    
            async public void Test()
            {
                var effects = new FilterEffect(source);
                effects.Filters = new IFilter[]
                {
                    new RotationFilter(10.0)
                };
    
                var customFilter = new ThresholdFilter(effects, 200, 200, 0);
    
                renderer = new WriteableBitmapRenderer(customFilter, outputBitmap);
                await renderer.RenderAsync();
    
                BitmapImageSource bitmapSource = new BitmapImageSource(outputBitmap.AsBitmap());
    
                var effects2 = new FilterEffect(bitmapSource);
                effects2.Filters = new IFilter[]
                {
                    new AntiqueFilter()
                };
    
                renderer = new WriteableBitmapRenderer(effects2, outputBitmap);
    
                await renderer.RenderAsync();
    
                outputBitmap.Invalidate();
            }
    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

    Code:
            private StreamImageSource source = null;
            private WriteableBitmapRenderer renderer = null;
            public WriteableBitmap outputBitmap;
    
            async public void Test()
            {
                var effects = new FilterEffect(source);
                effects.Filters = new IFilter[]
                {
                    new RotationFilter(10.0),
                    new AntiqueFilter() 
                    //built-in filters as many as you want, implement here 
                };
    
                var customFilter = new ThresholdFilter(effects, 200, 200, 0);
    
                renderer = new WriteableBitmapRenderer(customFilter, outputBitmap);
                await renderer.RenderAsync();
                
               outputBitmap.Invalidate();
            }

  4. #4
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    419

    Re: Imaging SDK 1.0 Feedback Competition: Engin Kırmacı: Custom filter documentation!

    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.
    Windows 8, Windows phone 8 or Nokia Asha developer? Go to DVLUP

  5. #5
    Registered User
    Join Date
    Mar 2013
    Posts
    22

    Re: Imaging SDK 1.0 Feedback Competition: Engin Kırmacı: Custom filter documentation!

    Quote Originally Posted by yan_ View Post
    If you want develop your custom filter with C#, it's recommended to inherit from CustomEffectBase .
    You can do it. SDk is designed for that . And share elements between different pipeline too
    You said "Share elements between different pipeline", Is it different than my method? Because in my method it also time consuming beside memory usage. I have to call RenderAsync() two times.

    And final question, how to undo this "Filter > CustomFilter > IFilter" ?
    Last edited by Engin Kırmacı; 2013-11-29 at 13:31.

  6. #6
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    419

    Re: Imaging SDK 1.0 Feedback Competition: Engin Kırmacı: Custom filter documentation!

    Quote Originally Posted by Engin Kırmacı View Post
    You said "Share elements between different pipeline", Is it different than my method?
    I want say you can create several pipeline and share elements (the first steps).

    For example, in my updated article
    Code:
    source = new StreamImageSource(s);
    effects = new FilterEffect(source);
    rendererLR = new WriteableBitmapRenderer(effects, LRTmp);
    rendererHR = new WriteableBitmapRenderer(effects, HRTmp);
    here i create one Image source and one FilterEffect but two renderer. The two renderer use same input :
    source->effect->rendererLR
    source->effect->rendererHR


    Quote Originally Posted by Engin Kırmacı View Post
    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
    Windows 8, Windows phone 8 or Nokia Asha developer? Go to DVLUP

  7. #7
    Registered User
    Join Date
    Mar 2013
    Posts
    22

    Re: Imaging SDK 1.0 Feedback Competition: Engin Kırmacı: Custom filter documentation!

    Quote Originally Posted by yan_ View Post
    I want say you can create several pipeline and share elements (the first steps).

    For example, in my updated article
    Code:
    source = new StreamImageSource(s);
    effects = new FilterEffect(source);
    rendererLR = new WriteableBitmapRenderer(effects, LRTmp);
    rendererHR = new WriteableBitmapRenderer(effects, HRTmp);
    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

    Finally, I agree with you CustomFilter is like beta

  8. #8
    Registered User
    Join Date
    Mar 2013
    Posts
    22

    Re: Imaging SDK 1.0 Feedback Competition: Engin Kırmacı: Custom filter documentation!

    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.

  9. #9
    Nokia Developer Champion
    Join Date
    Nov 2011
    Location
    la bouexiere, france
    Posts
    419

    Re: Imaging SDK 1.0 Feedback Competition: Engin Kırmacı: Custom filter documentation!

    Interesting.

    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
    Windows 8, Windows phone 8 or Nokia Asha developer? Go to DVLUP

  10. #10
    Registered User
    Join Date
    Mar 2013
    Posts
    22

    Re: Imaging SDK 1.0 Feedback Competition: Engin Kırmacı: Custom filter documentation!

    Quote Originally Posted by yan_ View Post
    Interesting.

    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.

Similar Threads

  1. Nokia Imaging and Big UI Wiki Competition 2013Q4 - articles and feedback
    By hamishwillee in forum Windows Phone Imaging
    Replies: 1
    Last Post: 2013-12-24, 04:33
  2. Nokia Imaging SDK Feedback (Competition)
    By skalogir in forum Windows Phone Imaging
    Replies: 77
    Last Post: 2013-11-15, 00:22
  3. Replies: 7
    Last Post: 2012-07-25, 01:25

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •