Create Mirror Image using MATLAB Last Updated : 21 Nov, 2019 Comments Improve Suggest changes Like Article Like Report 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. Code #1: Using MATLAB Library function MATLAB % Read the target image file img = imread('leaf.png'); % Reverse the element in each row mirror_image = flip(img, 2); % Display the mirror image imshow(mirror_img); title('Mirror image'); Code #2: Using matrix manipulation MATLAB % Read the target image file img = imread('leaf.png'); % Flip the columns left to right mirror_image = img(:, end :, -1:, 1, :); % Display the mirror image imshow(mirror_img); title('Mirror image'); Code #3: Using matrix manipulation (Using loops) Approach: Read the source image file in MATLAB environment Get the Dimensions of the image matrix Reverse the order of the elements of each row in every image plane Display the mirror image Below is the implementation of the above approach: MATLAB % Read the target image file img = imread('leaf.png'); % Get the dimensions of the image [x, y, z] =size(img); % Reverse elements of each row % in every image plane for plane = 1: z for i = 1 : x len = y; for j = 1 : y % To reverse the order of the element % of a row we can swap the % leftmost element of the row with % its rightmost element if j < y/2 temp = img(i, j, plane); img(i, j, plane) = img(i, len, plane); img(i, len, plane) = temp; len = len - 1; end end end end % Display the mirror image imshow(img); title('Mirror image'); Input Image: leaf.png Output: Comment More infoAdvertise with us Next Article Create Mirror Image using MATLAB I ihritik Follow Improve Article Tags : Computer Graphics Image-Processing MATLAB Similar Reads Create a Simple App Using GUIDE in MATLAB MATLAB is a (Matrix-Laboratory), matrix-based programming language platform that is majorly used to solve math work and real-time problems. it's specifically designed for engineers and scientists to analyze and design systems. And also capable to solve real-time problems with some histogram equaliza 3 min read LSB based Image steganography using MATLAB Prerequisite: Image Steganography Introduction, Implementation using Python.Steganography is the method of hiding secret data inside any form of digital media. The main idea behind steganography is to hide the existence of data in any medium like audio, video, image, etc. When we talk about image st 4 min read 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 algorith 2 min read Create Polar Axes in MATLAB Polar Axes/Coordinate system is a type of coordinate system which rather than using the traditional cartesian axes with X and Y axes uses polar coordinates, which consists of a magnitude vector (r) and its corresponding angle (\theta    ). The conversion from polar to cartesian coordinate is simple 3 min read How to draw Japan flag using MATLAB Prerequisite: RGB Image Representation MATLAB, also called Matrix Laboratory, is a numerical computing environment and a platform for programming languages. It was designed and developed by MathWorks. MATLAB is a framework that allows us to perform matrix manipulations, implementing algorithms, plot 3 min read Like