You are currently viewing Extracting Image Properties using MATLAB

Extracting paradigm properties means finding out the data nearly the prototype. For example – the proper name of the image, location, format, coding method, acme weight and other relevant information. In epitome processing you will frequently need to extract prototype properties. And doing it using MATLAB is a slice of cake. Because, MATLAB has a function named 'iminfo' to excerpt epitome properties. This office reads all of the pieces of information an paradigm. As a issue, extracting image backdrop using MATLAB has become this much easier. Today nosotros will learn how to use MATLAB'southward 'iminfo' function. You lot tin learn either by reading from here or by watching the following video lecture on extracting prototype properties using MATLAB:

[embedyt] https://www.youtube.com/watch?v=0TiXHhyBAtk[/embedyt]
Please Subscribe my Channel:

The 'iminfo' function takes the location of the paradigm as arguments and returns a 'struct' data structure. In MATLAB 'struct' is a structural array. Hither, data are grouped together using data containers. These containers are called 'fields'. These fields can contain whatsoever types of information. In order to access the data stored in a particular field, nosotros have to utilize the dot notation of MATLAB (structName.fieldNmae). So, y'all have understood where and how 'iminfo' part stores the paradigm properties and how to extract them. Now, we will extract some paradigm properties using the 'iminfo' function using the post-obit snippet:

info=imfinfo('C:/cat.jpg'); % Employ proper address of the epitome   % storing image information in variables image_name = info.Filename; image_Modification_Date = info.FileModDate; image_Size = info.FileSize; image_Format = info.Format; image_Format_Version = info.FormatVersion; image_Width = info.Width; image_Height = info.Height; image_Color_Type = info.ColorType; image_Number_of_Samples = info.NumberOfSamples; image_Coding_Method = info.CodingMethod; image_Coding_Process = info.CodingProcess;   % displaying the paradigm information fprintf('The proper name of the image is %south \n',image_name); fprintf('The concluding modification date is %due south \n', image_Modification_Date); fprintf('The size of the prototype is %d pixels\n',image_Size); fprintf('The format of the image is %south \n',image_Format); fprintf('The width the image is %d \n',image_Width); fprintf('The height of the epitome is %d \due north',image_Height); fprintf('The color blazon is %s \n',image_Color_Type); fprintf('The number of sample %d \n',image_Number_of_Samples); fprintf('The image coding method used is %due south \n',image_Coding_Method); fprintf('The epitome coding procedure is %s \n',image_Coding_Process);            

In the showtime line, nosotros have used 'info=imfinfo('C:/cat.jpg');'. That ways, now the 'info' is the structured assortment and contains all of the image backdrop in different containers. In order to admission the values of those containers we have to use MATLAT's dot note followed by the name of the 'field' of the container. One time of the field names is 'Filename'. Information technology contains the name and location of the image. In society to extract the information stored in this container, nosotros take to write 'info.Filename' and assign the value to a variable. In the snippet the height, weight, size and other image properties take been extracted.

However, this snippet has been designed for you to understand the concept properly. You lot can excerpt image properties using MATLAB using 'iminfo' role only, without using dot notation. In this case, all of the image backdrop will exist shown in the command window. In order to do it simply re-create the following line and run information technology in MATLAB. And do non forget to change the path of the prototype according to the location of your paradigm.

info=imfinfo('C:/true cat.jpg')

I hope this article volition be helpful in unlike situation while working in the field of Image Processing.