blImageTiling — Algorithms to augment opencv images in various ways

This entry is part 11 of 17 in the series blImageAPI -- BarbatoLabs Image API

Introduction

In this article I will collect all the different algorithms I have and will develop for ways to augment multiple images together using the blImageAPI.

List of functions

Here I list the current functions I have include so far. The list will grow, so make sure to come back for updates.

Note: The images can be of different size

  1. AugmentTwoMatricesRowWise

    1. Used to tile two images one on top of each other.
    2. There are two versions of this function, one that returns the augmented matrix and one that takes the augmented image as a parameter (saves time if augmented images is already the correct size)
  2. AugmentTwoMatricesColumnWise

    1. Used to tile two images side by side.
    2. There are two versions of this function, one that returns the augmented matrix and one that takes the augmented image as a parameter (saves time if augmented images is already the correct size)

The code

I have put all the functions in a file called blImageTiling.hpp which follows:

blImageTiling.hpp (Click to see code…)

Usage

There are many potential uses for image tiling. The following simple snippet loads two images and augments them side by side. It’s that easy.

int main(int argc, char *argv[])
{
    // Load the first image
    blImage< blColor3<unsigned char> > Image1;
    Image1.LoadImageFromFile("C:/Users/navyenzo/Desktop/Sample01.jpg");

    // Load the second image
    blImage< blColor3<unsigned char> > Image2;
    Image2.LoadImageFromFile("C:/Users/navyenzo/Desktop/Sample02.jpg");

    // Create the augmented image
    blImage< blColor3<unsigned char> > AugmentedImage;

    // Augment the images side by side
    // and show the new augmented image
    AugmentedImage = AugmentTwoMatricesColumnWise(Image1,Image2);

    // Show the first image
    cvShowImage("First Image",Image1);

    // Show the second image
    cvShowImage("Second Image",Image2);

    // Show the augmented image
    cvShowImage("Augmented Image",AugmentedImage);

    // Wait for key
    cvWaitKey(0);
}

The first is the following:

The second image is the following:

Finally after running the snippet we get:

Note: The two images are of different sizes, but the functions take care of that

Downloads

I have put all the files into a zip file which can be downloaded here. All you have to do is extract it somewhere, let’s say in a directory called blImageAPI, and then include the blImageAPI.hpp file as follows:

#include "blImageAPI/blImageAPI.hpp"
using namespace blImageAPI;

Note:  Everything is declared in a namespace blImageAPI, and such you would use it as: blImageAPI::blImage

blImageAPI.zip -- Ver Jun/06/2011 1:43pm (5060)

Updates

I will be adding more functions as I develop them, so check back soon for updates

About Vincenzo Barbato

Known to his friends as Enzo, he's an outside-the-box engineer/researcher whose interests and expertise span many fields, including controls systems, multi-physics simulations, mechatronics, oil technologies, data analysis and machine vision just to name a few.

Refusing to grow up, he's on a continuous journey to develop simple and creative solutions that have the power of disrupting industries by optimizing systems and processes.

Married to a beautiful wife, with two beautiful daughters and two identical twin boys, his home is a never ending chaotic fountain of inspiration.

His outlook on life:

"Never blindly accept what you're told, listen, but then question, with curiosity, creativity and collaboration we can change the world"

About Enzo

Known to his friends as Enzo, he's an outside-the-box engineer/researcher whose interests and expertise span many fields, including controls systems, multi-physics simulations, mechatronics, oil technologies, data analysis and machine vision just to name a few. Refusing to grow up, he's on a continuous journey to develop simple and creative solutions that have the power of disrupting industries by optimizing systems and processes. Married to a beautiful wife, with two beautiful daughters and two identical twin boys, his home is a never ending chaotic fountain of inspiration. His outlook on life: "Never blindly accept what you're told, listen, but then question, with curiosity, creativity and collaboration we can change the world"

One Comment

  1. Pingback: blImageOperators — Overloaded operators and functions to use blImage as a generic matrix in c++ | BarbatoLabs

Leave a Reply

Your email address will not be published. Required fields are marked *