hibyegh / aforge

Automatically exported from code.google.com/p/aforge
Other
0 stars 0 forks source link

Behaviour mismatch between SobelEdgeDetector.Apply and SobelEdgeDetector.ApplyInPlace #142

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
After executing the following code (referenced input and output files attached)
static void Main(string[] args) {
    Bitmap bmp = new Bitmap("image.bmp");
    new Threshold(20).Apply(new SobelEdgeDetector().Apply(bmp)).Save("1.bmp");
    BitmapData data = bmp.LockBits(new Rectangle(new Point(0, 0), bmp.Size), ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed);
    new SobelEdgeDetector().ApplyInPlace(data);
    new Threshold(20).ApplyInPlace(data);
    bmp.UnlockBits(data);
    bmp.Save("2.bmp");
}
1.bmp and 2.bmp do not match. The issue remains if the Threshold filter is 
removed, but it is much harder to spot.

The differences I have noted are on the right and bottom edges of the output 
bitmaps. In 2.bmp, pixels (1279,595)-(1279,1023), (205,1023), (206,1023) and 
(213,1023)-(1279,1023) are white, while those same pixels are black in 1.bmp. 
The expected result (in case this isn't obvious) is that 1.bmp and 2.bmp match, 
both with and without the application of the Threshold filter.

I am using AForge.NET framework version 2.1.3; AForge.Imaging.dll has the MD5:
fdd954dd0664866fb7428eba1fcb30a1 *AForge.Imaging.dll

Original issue reported on code.google.com by dales...@gmail.com on 2 Aug 2010 at 2:42

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by andrew.k...@gmail.com on 23 Aug 2010 at 6:20

GoogleCodeExporter commented 9 years ago
Putting black rectangle around processing area, so result of edge detectors 
look the same in the case if Apply() or ApplyInPlace() methods are called 
(ApplyInPlace() was leaving some garbage from original image).

Committed in 1302 revision. Will be released in 2.1.4 version.

Original comment by andrew.k...@gmail.com on 23 Aug 2010 at 6:24

GoogleCodeExporter commented 9 years ago

Original comment by andrew.k...@gmail.com on 1 Sep 2010 at 7:02