Here we explain uint8 data variable addition , subtraction and division.This uint8 is one of the data type in matlab. It stores the values up '0' to '255'.Your normal addition/subtraction/division not supported for this type of variables in matlab.This variable are also called as Image variable.
Here addition,subtraction and division's are used following commands
- Addition using 'imadd' function.
- Division using 'imdivide' function.
- Multiplication using 'immultiply' function.
This above functions only used this type of variable.This function also support for Image.Read two images after convert uint8 format variable then add the two variables.then you got two added image in one image.
Here below we give the example of this Uint8 type variables addition and subtraction.
>> b = uint8(round(rand(1,10)*255))
b =
180 8 71 12 25 210 177 81 242 9
>> a = uint8(round(rand(1,10)*255))
a =
112 97 195 203 48 125 114 165 181 192
>> imadd(a,b)
ans =
255 105 255 215 73 255 255 246 255 201
Here we use two random variables 'a' and 'b'.Then these two uint8 variables add using imadd function.These added result we finally shown.Here added values not grater than 255*.Please check it.While using subtraction result not lesser than 0.Like division function also.
No comments:
Post a Comment