locked
Converting pixels to gray RRS feed

  • Question

  • I'm trying to convert pixels to a gray image but can only find techniques that work with BitmapData data types.

    Windows Store application don't have access to BitmapData capabilities. BitmapData also provides the "Scan0" and "Stride" variables that are provided need to loop through pixel data.

    Any guidance is appreciated.

    How to convert to gray - code so far
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    PixelDataProvider dataProvider =
        await bitmapframe.GetPixelDataAsync(BitmapPixelFormat.Bgra8,
                                            BitmapAlphaMode.Premultiplied,
                                            new BitmapTransform(),
                                            ExifOrientationMode.RespectExifOrientation,
                                            ColorManagementMode.ColorManageToSRgb);
    pixels = dataProvider.DetachPixelData();

    //get the pixel from the original image
    for (int index = 0; index < pixels.Length; index++)
    {
        // pixels[index] = ConvertToGray(pixels, index);
    }

    Bruno Terkaly


    Friday, January 3, 2014 10:33 PM

Answers