image arithmetic result not the same
1 view (last 30 days)
Aaron Connell on 26 Feb 2018
Good evening, I have a question about image arithmetic. Below is some code that reads in a grayscale image and performs arithmetic on it. I want to know why the modified image does not look the same when we essentially divided the image pixels by 64 and then multiplied the result by 64. the resulting image should have been identical. Below is the image of the result:
class(b); %shows it is a uint8 image
Walter Roberson on 26 Feb 2018
we deduce from this that when you do arithmetic on an int8 or uint8, the result is always as if you had done the arithmetic in double precision, then rounded it, and converted back to the data type.