Fixed the intensity correction:

I implemented my own closing operation that uses a 1x3 kernel instead of
the default 3x3 kernel.
I had to add a border to my BinaryProcessor to not generate artefacts
when running the closing.
The debug mode has been optimized.