Image Antialising


  • Hi all,

    I'm having some troubles with the buildin antialising and Bitmaps. What I am trying to do is displaying a video coming from a camera frame by frame. The cam deliveres Bitmaps in a given format (not changing), I grab those frames, convert them to a BitmapSource and display them using an Image control. The control is set to the exact size of the images. The image itself is a grayscale image with some fine (1 pixel width) drawings (circles/lines) on it. The image itself is a rect, but the visable area is a circle that is surrounded by a black mask - part of the image.
    The first issue is that the pixels next to the mask are antialised, they appear to have a gray overlay. This can be fixed by setting the RenderingOptions.SetBitmapScalingMode(control, BitmapScaling.NearestNeighbour).
    But this will have two sideeffects:
     - The Edges of the Mask change a little bit (seems like some pixels are moved).
     - The "drawings" within the image appear to be "damanged" -> circles tend to have single pixels that are placed outside the circle.

    I am not forced to use the Image control, So i tried this: . It works not that bad, but it has a lot of bugs and initialisation issues, so i dropped it and got back to the Image.

    Any suggestions are welcome...

    Thursday, September 2, 2010 12:51 PM

All replies

  • Hi Jaster,

    Based on my understanding, WPf rendering is anti-aliasing in default. "by setting the RenderingOptions.SetBitmapScalingMode(control, BitmapScaling.NearestNeighbour)" can disable the anti-aliasing, but it seems you meet the new issues. It is hard to compromise anti-aliasing and sofe edges. Unfortunately, WPF rendering does not provide the compromise. We may need to process the bitmaps before rendering them, to soften them.

    For the third party library of video rendering, you may try the below one:

    Hope this helps.


    Bob Bao

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Tuesday, September 7, 2010 3:17 AM