I want to convert my original 8-bit depth gray scale image to a 7-bit depth gray scale image (pixel values should be in the range [0 127]
.
I use the below syntax, however pixels with value equal to 255
will change to 128
(it seems they are rounded after division, i.e. 127.5
changes to 128
). How can I resolve this issue and keep my pixel values in the range [0 127]
after division?
RGB = imread('camera_man128x128.png')% read 8-bit image
RGB = RGB*0.5; %change pixel value to be in range to 0~127
%however pixels with value 255 change to 128.
unit8
but only I want to change data scale from 0~127. – VSB