Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to blend a horizontal and vertical image?

Hello

I have those two images: http://imgur.com/a/SiGIW and http://imgur.com/a/4UJ6D

I'd like to blend the overlapping parts in order to obtain an image like this (but where the corners are blended):

http://imgur.com/a/ylY6m ---> http://imgur.com/a/fwIMN

On the last image you can see that the 2 parts of my image are overlapping, while I actually like to blend that region.

How can this be achieved?

Thanks

How to blend a horizontal and vertical image?

Hello

I have those two images: http://imgur.com/a/SiGIW and http://imgur.com/a/4UJ6Dhttp://imgur.com/a/whGYM

I'd like to blend the overlapping parts in order to obtain an image like this (but where the corners are blended):

http://imgur.com/a/ylY6m ---> http://imgur.com/a/fwIMN

On the last image you can see that the 2 parts of my image are overlapping, while I actually like to blend that region.

How can this be achieved?

Thanks

How to blend a horizontal and vertical image?

Hello

I have those two images: http://imgur.com/a/SiGIW and http://imgur.com/a/whGYM

I'd like to blend the overlapping parts in order to obtain an image like this (but where the corners are blended):

http://imgur.com/a/ylY6m ---> http://imgur.com/a/fwIMN

On the last image you can see that the 2 parts of my image are overlapping, while I actually like to blend that region.

How can this be achieved?achieved without creating artifacts?

Thanks

How to blend a horizontal and vertical image?

Hello

I have those two images: http://imgur.com/a/SiGIW and http://imgur.com/a/whGYMimages:

image description

image description

I'd like to blend the overlapping parts in order to obtain an image like this (but where the corners are blended):

http://imgur.com/a/ylY6m ---> http://imgur.com/a/fwIMN image description

On the last image you can see that the 2 parts of my image are overlapping, while I actually like to blend that region.

How can this be achieved without creating artifacts?

Thanks

i tried the code below so far

//g++ stitcher2.cpp $(pkg-config --cflags --libs opencv) -o main

#include <opencv2/opencv.hpp>
#include "opencv2/core.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/aruco.hpp"
#include "opencv2/aruco/dictionary.hpp"
#include "opencv2/calib3d.hpp"

#include <sstream>
#include <iostream>
#include <fstream>

using namespace std;
using namespace cv;


int main(void)
{

    Mat horizontalImg = imread("/home/a/Desktop/part1.png");
    Mat verticalImg = imread("/home/a/Desktop/part2.png");
    Mat output = Mat::zeros(horizontalImg.cols, verticalImg.rows, CV_8UC3);

    //imshow("a", horizontalImg);
    //imshow("b", verticalImg);
    //waitKey(0);

    int widthOverlap = 149;
    int heightOverlap = 152;
    Vec3b white = (255, 255, 255);

    for(int i=0;i<verticalImg.rows;i++)
    {
        for(int j=0;j<horizontalImg.cols;j++)
        {
            if(i<heightOverlap)
            {
                if(j<widthOverlap)
                {
                    output.at<Vec3b>(i,j) = (0.5 * horizontalImg.at<Vec3b>(i,j)) + (0.5 * verticalImg.at<Vec3b>(i,j));

                }
                else
                {
                    output.at<Vec3b>(i,j) = horizontalImg.at<Vec3b>(i,j);
                }
            }
            if(j<widthOverlap)
            {
                if(i>heightOverlap)
                {
                   output.at<Vec3b>(i,j) = verticalImg.at<Vec3b>(i,j);
                }                
            }
            if(j>widthOverlap)
            {
                if(i>heightOverlap)
                {
                   output.at<Vec3b>(i,j) = white;
                }                
            }

        }
    }

    imshow("final result", output);
    waitKey(0);


    return 0;
}

How to blend a horizontal and vertical image?

Hello

I have those two images:

image description

image description

I'd like to blend the overlapping parts in order to obtain an image like this (but where the corners are blended):

image description

On the last image you can see that the 2 parts of my image are overlapping, while I actually like to blend that region.

How can this be achieved without creating artifacts?

Thanks

i tried the code below so far

//g++ stitcher2.cpp $(pkg-config --cflags --libs opencv) -o main

#include <opencv2/opencv.hpp>
#include "opencv2/core.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/aruco.hpp"
#include "opencv2/aruco/dictionary.hpp"
#include "opencv2/calib3d.hpp"

#include <sstream>
#include <iostream>
#include <fstream>

using namespace std;
using namespace cv;


int main(void)
{

    Mat horizontalImg = imread("/home/a/Desktop/part1.png");
    Mat verticalImg = imread("/home/a/Desktop/part2.png");
    Mat output = Mat::zeros(horizontalImg.cols, verticalImg.rows, CV_8UC3);

    //imshow("a", horizontalImg);
    //imshow("b", verticalImg);
    //waitKey(0);

    int widthOverlap = 149;
    int heightOverlap = 152;
    Vec3b white = (255, 255, 255);

    for(int i=0;i<verticalImg.rows;i++)
    {
        for(int j=0;j<horizontalImg.cols;j++)
        {
            if(i<heightOverlap)
            {
                if(j<widthOverlap)
                {
                    output.at<Vec3b>(i,j) = (0.5 * horizontalImg.at<Vec3b>(i,j)) + (0.5 * verticalImg.at<Vec3b>(i,j));

                }
                else
                {
                    output.at<Vec3b>(i,j) = horizontalImg.at<Vec3b>(i,j);
                }
            }
            if(j<widthOverlap)
            {
                if(i>heightOverlap)
                {
                   output.at<Vec3b>(i,j) = verticalImg.at<Vec3b>(i,j);
                }                
            }
            if(j>widthOverlap)
            {
                if(i>heightOverlap)
                {
                   output.at<Vec3b>(i,j) = white;
                }                
            }

        }
    }

    imshow("final result", output);
    waitKey(0);


    return 0;
}

And this is the result: https://i.imgur.com/YDE6DDZ.png

How to blend a horizontal and vertical image?

Hello

I have those two images:

image description

image description

I'd like to blend the overlapping parts in order to obtain an image like this (but where the corners are blended):

image description

On the last image you can see that the 2 parts of my image are overlapping, while I actually like to blend that region.

And this is the result i obtained so far by using the code below : image description

How can this be achieved without creating artifacts?

Thanks

i tried the code below so far

//g++ stitcher2.cpp $(pkg-config --cflags --libs opencv) -o main

#include <opencv2/opencv.hpp>
#include "opencv2/core.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/aruco.hpp"
#include "opencv2/aruco/dictionary.hpp"
#include "opencv2/calib3d.hpp"

#include <sstream>
#include <iostream>
#include <fstream>

using namespace std;
using namespace cv;


int main(void)
{

    Mat horizontalImg = imread("/home/a/Desktop/part1.png");
    Mat verticalImg = imread("/home/a/Desktop/part2.png");
    Mat output = Mat::zeros(horizontalImg.cols, verticalImg.rows, CV_8UC3);

    //imshow("a", horizontalImg);
    //imshow("b", verticalImg);
    //waitKey(0);

    int widthOverlap = 149;
    int heightOverlap = 152;
    Vec3b white = (255, 255, 255);

    for(int i=0;i<verticalImg.rows;i++)
    {
        for(int j=0;j<horizontalImg.cols;j++)
        {
            if(i<heightOverlap)
            {
                if(j<widthOverlap)
                {
                    output.at<Vec3b>(i,j) = (0.5 * horizontalImg.at<Vec3b>(i,j)) + (0.5 * verticalImg.at<Vec3b>(i,j));

                }
                else
                {
                    output.at<Vec3b>(i,j) = horizontalImg.at<Vec3b>(i,j);
                }
            }
            if(j<widthOverlap)
            {
                if(i>heightOverlap)
                {
                   output.at<Vec3b>(i,j) = verticalImg.at<Vec3b>(i,j);
                }                
            }
            if(j>widthOverlap)
            {
                if(i>heightOverlap)
                {
                   output.at<Vec3b>(i,j) = white;
                }                
            }

        }
    }

    imshow("final result", output);
    waitKey(0);


    return 0;
}

And this is the result: https://i.imgur.com/YDE6DDZ.png

How to blend a horizontal and vertical image?

Hello

I have those two images:

image description

image description

I'd like to blend the overlapping parts in order to obtain an image like this (but where the corners are blended):

image description

On the last image you can see that the 2 parts of my image are overlapping, while I actually like to blend that region.

And this is the result i obtained so far by using the code below : image description

I actually want to obtain a continuous smooth image.

How can this be achieved without creating artifacts?

Thanks

//g++ stitcher2.cpp $(pkg-config --cflags --libs opencv) -o main

#include <opencv2/opencv.hpp>
#include "opencv2/core.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/aruco.hpp"
#include "opencv2/aruco/dictionary.hpp"
#include "opencv2/calib3d.hpp"

#include <sstream>
#include <iostream>
#include <fstream>

using namespace std;
using namespace cv;


int main(void)
{

    Mat horizontalImg = imread("/home/a/Desktop/part1.png");
    Mat verticalImg = imread("/home/a/Desktop/part2.png");
    Mat output = Mat::zeros(horizontalImg.cols, verticalImg.rows, CV_8UC3);

    //imshow("a", horizontalImg);
    //imshow("b", verticalImg);
    //waitKey(0);

    int widthOverlap = 149;
    int heightOverlap = 152;
    Vec3b white = (255, 255, 255);

    for(int i=0;i<verticalImg.rows;i++)
    {
        for(int j=0;j<horizontalImg.cols;j++)
        {
            if(i<heightOverlap)
            {
                if(j<widthOverlap)
                {
                    output.at<Vec3b>(i,j) = (0.5 * horizontalImg.at<Vec3b>(i,j)) + (0.5 * verticalImg.at<Vec3b>(i,j));

                }
                else
                {
                    output.at<Vec3b>(i,j) = horizontalImg.at<Vec3b>(i,j);
                }
            }
            if(j<widthOverlap)
            {
                if(i>heightOverlap)
                {
                   output.at<Vec3b>(i,j) = verticalImg.at<Vec3b>(i,j);
                }                
            }
            if(j>widthOverlap)
            {
                if(i>heightOverlap)
                {
                   output.at<Vec3b>(i,j) = white;
                }                
            }

        }
    }

    imshow("final result", output);
    waitKey(0);


    return 0;
}