We are now aware of the fact that images if read in the MATLAB program, then they are just the matrices, according to RGB color model in which the pixel values are storing the information of content of color.
Most likely, Matrices were first introduced in my highschool elementary mathematics. For me, Matrix operations were very easy to understand. For this discussion, I assume that you are familiar with some matrix operations like as addition, subtraction, multiplication, division, etc.
Some similar matrix operations can also be performed using the image matrix and the results so obtained can be entertained to learn about image processing. There exist certain special operators that are specific to images only. These special operators operate on either two images of exactly same size or an image and a number.This implies that we are having two matrices of same order or a matrix and a scalar.
In the former case, we will be performing the operation on a pixel-by-pixel basis.
In the latter case, the scalar number is operated over the entire matrix that is all the pixels.
So let us try out some examples for image arithmetic.
1. Image Addition
Let us create a function to see image addition with our default image 'peppers.png'
function image_combine()
a = imread('peppers.png');
figure; imshow(a); title('original image')
add = imadd(a,a);
figure; imshow(add); title('addition of same image')
add1 = imadd(add,100);
figure; imshow(add1); title('Brightness enhanced')
According to the above function, the default image can be read and then added to itself. You can find easily the difference of intensity of colors in the original image and the image after addition to itself.
After this, I have another variable 'add1' in which a constant 100 is added, such that the value of each pixel will be increased and image brightness is augmented.
That's all for this discussion... Do not forget to check for image properties using iminfo() or imageinfo() and observe the changes in all the images, especially the pixel values. You can also inspect pixel values using imtool(), which we have covered in the previous discussions.
Most likely, Matrices were first introduced in my highschool elementary mathematics. For me, Matrix operations were very easy to understand. For this discussion, I assume that you are familiar with some matrix operations like as addition, subtraction, multiplication, division, etc.
Some similar matrix operations can also be performed using the image matrix and the results so obtained can be entertained to learn about image processing. There exist certain special operators that are specific to images only. These special operators operate on either two images of exactly same size or an image and a number.This implies that we are having two matrices of same order or a matrix and a scalar.
In the former case, we will be performing the operation on a pixel-by-pixel basis.
In the latter case, the scalar number is operated over the entire matrix that is all the pixels.
So let us try out some examples for image arithmetic.
1. Image Addition
Let us create a function to see image addition with our default image 'peppers.png'
function image_combine()
a = imread('peppers.png');
figure; imshow(a); title('original image')
add = imadd(a,a);
figure; imshow(add); title('addition of same image')
add1 = imadd(add,100);
figure; imshow(add1); title('Brightness enhanced')
According to the above function, the default image can be read and then added to itself. You can find easily the difference of intensity of colors in the original image and the image after addition to itself.
After this, I have another variable 'add1' in which a constant 100 is added, such that the value of each pixel will be increased and image brightness is augmented.
0 comments: