Otsu binarization with value preservation
I don't have Matlab handy, but here is how you do it in OpenCV. The example below uses the python interface via Python (x, y):

test = cv2.imread("test.jpg", 0)
(_, otsu) = cv2.threshold(test, 0.0, 255.0, cv2.THRESH_TOZERO_INV + cv2.THRESH_OTSU)
cv2.imshow('otsu', otsu)


This results in your required output:


EDIT : I don't have a copy of Matlab, but I think this is how you would do it (assuming you have the Image Processing Toolbox):

Use graythresh to get the Otsu level, then set anything above that level to white (or 255).

I = imread('doc.jpg');
I = rgb2gray(I);
otsuLevel = graythresh(I);
I(I &gt; otsuLevel) = 255;


Hope that helps!