In this post, I would like to show you how to read, write and display an image using MATLAB.
How to Read an Image
You can read an image in a MATLAB using imread() function. The imread() function takes the input image as a parameter. The imread function read all the entire pixels information of the image in a matrix form. The following figure shows the MATLAB code for reading a particular image.
How to Display an Image
For displaying an image in MATLAB, you first need to read that particular image. After you read the image using imread() as shown in the above figure, you can then display the image. To display the image, you need to write imshow() function of MATLAB. The following figure shows the MATLAB code for displaying an image.
How to Write or Save the Image
To write/save the image after performing some mathematical operations on it, you can use imwrite() function. The imwrite() function takes two parameters to perform its functionality. First, it will take the image you want to save and the name of the image you want to give it. The following figure show the MATLAB code for writing the image.
Thanks for viewing my post, if you have any query about this post, please comment it.
Sir,i am getting an error
ReplyDelete