0

im searching for a good imaging SDK for windows phone ...

i tried to use Nokia SDK but it didn't work for me, it keeps showing as exception:

"Operation Is Not Valid Due To The Current State Of The Object."

here is my test code:

The processImage method is used to apply the filter on the image.

private async void processImage()
        {
            WriteableBitmap writeableBitmap = new WriteableBitmap((int)bitmapImage.PixelWidth, (int)bitmapImage.PixelHeight);            
            try
            {
                using (var imageStream = new StreamImageSource(photoStream))
                {
                    // Applying the custom filter effect to the image stream
                    using (var customEffect = new NegateFilter(imageStream))
                    {
                        // Rendering the resulting image to a WriteableBitmap
                        using (var renderer = new WriteableBitmapRenderer(customEffect, writeableBitmap))
                        {
                            // Applying the WriteableBitmap to our xaml image control
                             await renderer.RenderAsync();
                             imageGrid.Source = writeableBitmap;
                        }
                    }
                }
            }
            catch (Exception exc) { MessageBox.Show(exc.Message + exc.StackTrace, exc.Source, MessageBoxButton.OK); }
        }

This is the NegateFilter class:

namespace ImagingTest
{
    class NegateFilter : CustomEffectBase
    {
        public NegateFilter(IImageProvider source) : base(source){}

        protected override void OnProcess(PixelRegion sourcePixelRegion, PixelRegion targetPixelRegion)
        {
            sourcePixelRegion.ForEachRow((index, width, pos) =>
            {
                for (int x = 0; x < width; ++x, ++index)
                {            
                    targetPixelRegion.ImagePixels[index] = 255 - sourcePixelRegion.ImagePixels[index];
                }
            });
        }

    }
}

any ideas for a good imaging SDK? like ImageJ on java for example, or OpenCV .. i will be better to use Nokia SDK ..

thx :)

Petros Koutsolampros
  • 2,790
  • 1
  • 14
  • 20
Yazan
  • 15
  • 1
  • 4

2 Answers2

0

I looked in to you code and did a quick test. The code worked fine when I just made sure that the bitmapImage.PixelWidth and bitmapImage.PixelHeight > 0.

I did not get and image on the screen but when I remove your custom filter the image is show. I hope you will continue to use the SDK since it is a great product.

0

What about emguCV?

I am not try it yet but looks like it's possible with phone's camera.