MATLAB: How to change the more than one pixel values in gray scale image

change pixelgray scale

% I have gray image X (480×640 double), having values between 0 and 0 to 1, I want to change the values of all pixel to 1 that are closer to 1 and change values of all pixel to 0 that are near to 0.

Best Answer

Well, you shouldn't have accepted that answer so quickly if it didn't do what you asked. Here's how to "change the values of certain pixel to 1 that are closer to 1 and want to change values to 0 that are near to 0:
yourImage = yourImage >= 0.5;
Related Question