Update addng a +1 margin to the median

If the median occurs to be 0 or 255 (white or black) them add +/- 1
position do the median.