MATLAB – Read images using imread() function
MATLAB stands for Matrix Laboratory. It is a high-performance language that is used for technical computing. It was developed by Cleve Molar of the company MathWorks.Inc in the year 1984. It is written in C, C++, Java. It allows matrix manipulations, plotting of functions, implementation of algorithms, and creation of user interfaces.
In this article, we are going to discuss how to read images using MATLAB.
In-order to read images we are going to use the imread() function in MATLAB. The imread() function reads images from the graphics files.
A = imread(filename)
It simply read the image and stores it in A.
A = imread(filename,fmt)
Reads image in greyscale or color from the specified file.if image is not present in current directory then please provide the full path of image.
A = imread(Name,Value)
It peruses the predefined picture or pictures from a multi-picture record. This grammar applies just to GIF, PGM, PM, PPM, CUR, ICO, TIF, SVS, and HDF4 documents. You should indicate a filename information, and you can alternatively determine fmt.
Below is a program in which we read a color image using imread() function and store it in A (the imread() function restores the picture information in cluster A) and then we display the image using imshow() function.
Here is another example to read an image in MATLAB.
Note: In the event, if the image is grayscale then, A will be a two-dimensional (M-by-N) exhibit, or else A will be a three-dimensional (M-by-N-by-3) exhibit. The class of the returned cluster relies upon the information type utilized by the record design.