In order to get information about the type of variable/image or any object, use the following function-
and in order to know class, you can use-
To display the values of variable, use-
The uint8 data types have very limited dynamic range i.e from 0 to 255. So, whenever large any arithmetic operation is performed, it limits its result between 0 to 255. So, what it performs is clipping and rounding, which is collectively known as saturation. You can easily understand this with the help of following example:
When we have data type ‘double’:-
So, here it is giving the actual result. The exponent range of double is -1022 to 1021 and it occupies 8 times more memory than occupied by uint8 type. Let’s see what happens then if we use uint8 type of data and performed arithmetic operations like in previous case-
So, here you can see the difference. Addition of variable gives the result 255 rather than giving 300 because uint8 type limits to 255 maximum value only. Similarly, in case of subtraction, instead of giving negative value it returns the lowest possible unsigned integer value i.e 0. Here, clipping is performed. Now, in case of division, the result is rounded of to 1 from 0.5 as per the common rounding off rule.