Skip to content

"ApplyMask" and "MaskedFilter" filters doesn't work correctlly #411

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
1.First, thanks for create great AForge.net free library in image processing 
field.
2.I use the code "new ApplyMask(imageMask).ApplyInPlace(image);" in my project.
3.I use too the code "new MaskedFilter(new Sepia(), 
image).ApplyInPlace(image);" and "image" is an "AForge.Imaging.UnmanagedImage" 
that by "ref" pass to my mask filter.
4.static void ApplyBlobMaskingOnImage(ref AForge.Imaging.UnmanagedImage image, 
ref System.Drawing.Rectangle[] rects)
        {
            if (rects == null || rects.Length == 0)
                return;

            var imageMask = AForge.Imaging.UnmanagedImage.Create(
                image.Width, image.Height, image.PixelFormat);

            foreach (var rect in rects)
                if (rect != System.Drawing.Rectangle.Empty)
                    AForge.Imaging.Drawing.FillRectangle(imageMask, rect, System.Drawing.Color.White);

// I currently use this instead of:
            //new Invert().ApplyInPlace(imageMask);
            //new Subtract(imageMask).ApplyInPlace(image);

            // Bug
            new ApplyMask(imageMask).ApplyInPlace(image);
            //new MaskedFilter(new Sepia(), image).ApplyInPlace(image);
        }

What is the expected output? What do you see instead?
*When I pass an image in grayscale(8bpp) everything is ok, But pass a 
RGB(24bpp) image, unexpected region is show.

What version of the product are you using?
2.2.5

Please provide any additional information below.

Original issue reported on code.google.com by hashemza...@gmail.com on 13 Aug 2015 at 7:32

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions