I'm using MagickAdaptiveThresholdImage to apply an adaptive threshold on an image I have containing handwritten text. This works well for the text itself, but I'm having a problem like the one explained here(http://homepages.inf.ed.ac.uk/rbf/HIPR2/adpthrsh.htm) where the margin--that is, white space outside of the area of writing--is not uniform. In essence, most of the image should be white (the background), but instead I'm seeing this:

Is there anything I can do?
I'm not really familiar with image processing, so I apologize for not knowing the correct terminology to use.