Thursday, April 7, 2016

Attaching-Two-Images-side-by-side-Matlab-Program

Attaching Two Images side by side Matlab Program

By studying this article, one can understand the logic of attaching two images side by side by using Matlab. This logic is not only applicable for gray scale images but also for color images without converting them into gray scale. Matlab is very useful and easy tool for image processing. Most of the researchers use Matlab for their research.

Method 1: (using black border at the bottom) Among two images, the less height of the image is found and its height is increased by padding zeros so that the heights of two images are equal. Hence the black border is added at the bottom of the less height image.

% read images (two)
    image1 =  imread('E:/images/image1.jpg');
    image2 =  imread('E:/images/image2.jpg');

% find the less height image(row size is less) and increase the height by filling zeros
    rows1 = size(image1,1);
    rows2 = size(image2,1);
    if (rows1 < rows2)
        image1(rows2,1) = 0;
    else
        image2(rows1,1) = 0;
    end

% Now append both images side-by-side.
    image = [image1 image2];
    imshow(image);

Input: (Two images)
image1.jpg image2.jpg
Output: (after Attaching images)

Method 2: (without using black border at the bottom)

% read images(two)
    image1 =  imread('E:/images/image1.jpg');
    image2 =  imread('E:/images/image2.jpg');
    
% find the less height image(row size is less) and increase the height by
% using imresize function
    rows1 = size(image1,1);
    rows2 = size(image2,1);

    if (rows1 < rows2)
        image1= imresize(image1,[rows2,size(image1,2)]);
    else
        image2= imresize(image2,[rows1,size(image2,2)]);
    end
% Now append both images side-by-side.
    image = [image1 image2];
    imshow(image);

Input: (Two images) Same as Two images image1.jpg, image2.jpg Output: (after Attaching images)



See also:

1. matlab-cropping-binary-image-algorithm

Objective of the Program: Program takes a black and white image as input. It removes the black portion and gives the white portion of the image.

2. Working-with-ROI-of-image-using-Matlab

Objective of the Program:The part of the image, on which you have interest to work out, is called Region of Interest (ROI). In another words, selected subset of image is called ROI. In some contexts, you want to apply operations on ROI of image rather than the entire image. To achieve this, generally people extract the ROI from the image, store it in another variable and then apply operations on ROI. If you want to apply your operations on ROI without extracting from the image, it is bit difficult. This article will explain the performing the operations on ROI without extracting from the image. In this context, the ROI part of image is affected rather than the entire image.

Python-environment-for-deep-learning-in-windows

Python is increasingly becoming a popular programming language for machine learning and deep learning. If you want to use python for train...