STL like Template based coding with MMX/SSE extension


Accelerating with MMX/SSE extension is one of the most effective performance gain technique in image processing, signal processing and numerical computing. To accelerate your application with MMX/SSE, Intel provides the following solution

Combination of these solutions is one of the best solution. Open CV is an interface part of this combination. However coding based on OpenCV causes too messy and unreadable code. More sophisticated coding with MMX/SSE extension, can be achieved by wrapping OpenCV based on STL like code. STL like OpenCV wrapper (STLLCV) is wrapping of OpenCV which enables STL like more readable code. This wrapping is also interface to the following existing STL like libraries This wrapping can be also use as class of these liberties.

The followings are belief explanations about usage of this wrapping.

Matrix Operation Wrapping
uBLAS is matrix operation liberally based on expressional template technique. Expressional template technique enables simple description of complicated matrix operation. The interface to uBLAS . enables same simple description with various OpenCV bs functions. Usage of this wrapping is the following

Usage:

        #include "stllcv/ublascvmatrix.hxx"
        //init matrix
        CublasCvMatrix<float,3,3> A;
        A[0][0]=3; A[0][1]=2; A[0][2]=1;
        A[1][0]=1; A[1][1]=1; A[1][2]=4;
        A[2][0]=3; A[2][1]=2; A[2][2]=5;

        
        CublasCvMatrix<float,3,3> B;

        //Multiple as OpenCV matrix
        cvMatMul( &(CvMat)A , &(CvMat)A, &(CvMat) B );

        //Mutiple as uBLAS matrix
        B =boost::numeric::ublas::prod (A,A);


see more information about this class here

Image Operation Wrapping
VIGRA is STL like image processing library. VIGRA provides various STL style image processing functions. This interface to VIGRA enables STL style image processing with various OpenCV bs functions. Usage of this wrapping is the following Usage:

#include "vigra/transformimage.hxx"
#include "vigra/recursiveconvolution.hxx"

#include "stllcv/iplvbasicimageoperation.hxx"

#include "stllcv/iplvbasicimage.hxx"

#include "highgui.h"


#define PEXTYPE unsigned char

int 
main(int argc, char * argv[])
{


        char winName[]="srcImg";
        cvNamedWindow( winName, 1 );

        CiplvBasicImage<PEXTYPE> iplvImage1("lena.jpg");

        showIplvBasicImag<PEXTYPE>(&iplvImage1,winName);
        int width1 = iplvImage1.width();
        int height1 =iplvImage1.height();
        CiplvBasicImage<PEXTYPE> iplvImage2( width1*2 ,height1*2);

        std::fill(iplvImage2.begin(),iplvImage2.end(),100);
        iplRotate(iplvImage1.pIplImage, iplvImage2.pIplImage,30.0, 100 ,150 ,IPL_INTER_NN);     
        showIplvBasicImag<PEXTYPE>(&iplvImage2,winName);


        vigra::initImage(
                        destIterRange(
                                iplvImage2.upperLeft() + vigra::Diff2D(50, 100),iplvImage2.upperLeft() + vigra::Diff2D(400, 200))
                        ,200
                );
        showIplvBasicImag<PEXTYPE>(&iplvImage2,winName);


        vigra::transformImage(srcImageRange(iplvImage2), destImage(iplvImage2),
                           vigra::linearIntensityTransform(-1, -255));
        showIplvBasicImag<PEXTYPE>(&iplvImage2,winName);

        CiplvBasicImage<PEXTYPE> iplvImage3tmp( iplvImage2);
        CiplvBasicImage<PEXTYPE> iplvImage3( iplvImage2);

        int scale = 5;
        vigra::recursiveSmoothX(vigra::srcImageRange(iplvImage2)   , vigra::destImage(iplvImage3tmp), scale);
        vigra::recursiveSmoothY(vigra::srcImageRange(iplvImage3tmp), vigra::destImage(iplvImage3), scale);
        showIplvBasicImag<PEXTYPE>(&iplvImage3,winName);

        

        saveIplvBasicImag<PEXTYPE>(&iplvImage3, "out.jpg");


        cvDestroyWindow(winName);
        return 0;
}

see more information about this class here

Current version of this wrapping library can be downloaded from here STL like OpenCV wrapper (STLLCV)