Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Python Tutorial
  • Interview Questions
  • Python Quiz
  • Python Glossary
  • Python Projects
  • Practice Python
  • Data Science With Python
  • Python Web Dev
  • DSA with Python
  • Python OOPs
Open In App
Next Article:
How to Convert RGB Image to Binary Image Using MATLAB?
Next article icon

MATLAB – Read images using imread() function

Last Updated : 12 Dec, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

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.

Syntax:

A = imread(filename)

It simply read the image and stores it in A.

A = imread(filename,fmt)

Reads image in grayscale 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.

Example 1:

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. 

C++

% reading image
A = imread('g4g.jpg');
 
% displaying image
imshow(A);
                      
                       

Output:


 

Example 2:

Here is another example to read an image in MATLAB.

C++

% reading image
A = imread('g4g.jpg');
 
% displaying image
imshow(A);
                      
                       

Output:

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.



Next Article
How to Convert RGB Image to Binary Image Using MATLAB?

S

sanjaypoptani
Improve
Article Tags :
  • Computer Subject
  • MATLAB
  • Programming Language
  • Python
  • MATLAB
Practice Tags :
  • python

Similar Reads

  • Boundary Extraction of image using MATLAB
    The boundary of the image is different from the edges in the image. Edges represent the abrupt change in pixel intensity values while the boundary of the image is the contour. As the name boundary suggests that something whose ownership changes, in the image when pixel ownership changes from one sur
    3 min read
  • Image Resizing in Matlab
    Prerequisite : RGB image representation MATLAB stores most images as two-dimensional matrices, in which each element of the matrix corresponds to a single discrete pixel in the displayed image. Some images, such as truecolor images, represent images using a three-dimensional array. In truecolor imag
    2 min read
  • Create Mirror Image using MATLAB
    Prerequisite: Image representation in MATLAB In MATLAB, Images are stored in matrices, in which each element of the matrix corresponds to a single discrete pixel of the image. We can get the mirror image of the given image if we reverse the order of the pixels (elements of the matrix) in each row. C
    2 min read
  • How to Convert RGB Image to Binary Image Using MATLAB?
    An Image, by definition, is essentially a visual representation of something  that depicts or records visual perception. Images are classified in one of the three types.  Binary ImagesGrayscale ImagesColor ImagesBinary Images: This is the most basic type of image that exists. The only permissible pi
    3 min read
  • How to Convert RGB Image to YIQ Image using MATLAB?
    Image Processing in MATLAB use functions from the Image Processing Toolbox. This toolbox generally represents colors as RGB numeric values. Different models also exist for representing colors numerically. The official term for these models is "color spaces" and is coined from the definition of a vec
    2 min read
  • How to Convert YIQ Image to RGB Image Using MATLAB?
    Converting images from one color space to another is a handy process in image processing that provides convenience and eases the overall process by choosing the most accurate color space to work the image on. The YIQ color space, as the name suggests comprises of three components namely Luma (Y), In
    4 min read
  • Image Processing in MATLAB | Fundamental Operations
    1. Reading Images Images are read into the MATLAB Environment using imread() function which takes filename with applicable extension as the argument For Example: >> I=imread('nature.jpg'); This will read JPEG image 'nature' into the image array. Note: The semicolon(;) at the end of command lin
    3 min read
  • Python - Image() function in Wand
    In this specific article we will learn how to read our image through Python wand module. To read image in Wand we use Image() function. To manipulate an image first of all we need to read image in Python. Parameters : Parameter Input Type Description image Image make exact copy of image blob bytes o
    2 min read
  • How To Detect Face in Image Processing Using MATLAB?
    MATLAB  is a programming platform that is mainly used by engineers and scientists to analyze and design systems. Image processing is a process to perform some operations on an image to get an enhanced image or to extract some useful information from it. Each picture is stored as an array and each pi
    5 min read
  • Combine two images in MATLAB
    In this article, we will learn how to combine two images of the same size in MATLAB. Now, let's suppose we have been given two colored images of different sizes. One image has the main figure on the left side and the other has one on the right side. We need to combine the two images such that both f
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences