Pixel Data Types

In order to get information about the type of variable/image or any object, use the following function-

>> typeinfo(variable_name);

and in order to know class, you can use-

>> class(variable_name);

To display the values of variable, use-

>> display(variable_name);

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’:-

1So, 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-

2So, 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.


Published by


I am the one who discover myself daily through reading, writing, interacting with people and expressing my thoughts to inspire them if I would be able to bring a little change to the society through my work. I write blogs, participate in various social activities and want to be a Professional Speaker. Currently, I am pursuing my post graduation in Computer Applications from Guru Nanak Dev Engineering College, Ludhiana and I’m very much active in many technical & social communities.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s