kadorek / aforge

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

BradleyLocalThresholding converting to white rectangle the black rectangles in the image #308

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
First of all thanks for the great job on AFORGE. I am using for the first time 
the Adaptive Threshold BradleyLocalThresholding Class, it looks great and fast, 
but when we have black corners and/or black rectangles like in the image1 
attached, the filter is changing the middle of the rectangles and the corners 
to white color. This, I think was not the behavior expected. The corners should 
remain black and the rectangles should remain black. Can you please check if it 
is possible to fix this issue?

Thanks in advance,

Robson Reis

What steps will reproduce the problem?
1. Load the sample.jpg attached
2. Apply the BradleyLocalThresholding filter
3. See the result, similar to image2.jpg attached

What is the expected output? What do you see instead?
I would expect the black rectangles remain black and the upper lect corner 
remains black. Instead, what I see is the black rectangles with  white color in 
the middle

What version of the product are you using?
2.2.4

Please provide any additional information below.

Original issue reported on code.google.com by rei...@gmail.com on 10 Jul 2012 at 8:00

Attachments:

GoogleCodeExporter commented 8 years ago
I have found other collateral effect of this problem. It causes some barcodes 
to be corrupted, since some bars are black rectangles, they become with white 
inside, instead of a full black.

Original comment by rei...@gmail.com on 11 Jul 2012 at 10:56

GoogleCodeExporter commented 8 years ago
The implementation of the Bradley thresholding algorithm in AForge.NET 
framework just follows the referenced publication. Nothing more or less - just 
implementation of the algorithm as in paper.

You may try playing with parameters of the algorithm (WindowSize and 
PixelBrightnessDifferenceLimit) to see if those make any difference.

Also you are welcome to read the referenced paper to get more understanding of 
the algorithm.

However, if you cannot find anything wrong in the implementation itself, then 
there is not much we can do. If there is a problem in the algorithm itself, 
then it is not AForge.NET framework's fault.

So, if you find a bug/error in the implementation, then we can fix it. If not, 
then you may search/suggest another algorithm.

Original comment by andrew.k...@gmail.com on 11 Jul 2012 at 11:18

GoogleCodeExporter commented 8 years ago
Andrew, Thanks for your feedback. I understood your point, but I don't have 
enough knowledge to say your implementation of the Bradley algorithm is correct 
or not. The only thing that I know it is I can't use this because I have black 
rectangles and black corners in the image and barcode I can't corrupt. 
I have tried to play with PixelBrightnessDifferenceLimit and couldn't see any 
improvement.  Instead of Bradley, I am using OTSU now and it is fine to my 
needs. 
Thank you very much for such great job... I hope you can find time to continue 
to improve this API.
regards,

Robson Reis

Original comment by rei...@gmail.com on 11 Jul 2012 at 5:54