OpenCV Image Stitching ( ver 2.4.3 )

 

 

#1. Include header and using namespace


#include "opencv2/stitching/stitcher.hpp"
#include <vector> using namespace std;

 

#2. Convert IplImage* to cv::Mat


cv::Mat cvmatImg( iplImg , 0 );

 

#3. Convert cv::Mat to IplImage*


IplImage* cvMat2IplImage(cv::Mat input) { IplImage temp = IplImage(input); return cvCloneImage( & temp ); }

 

#4. Main code

  Input : vector<cv::Mat> imgs

  Output : cv::Mat out


bool
try_use_gpu = false; //--------------------------------------------------------- cv::Stitcher stitcher = cv::Stitcher::createDefault(try_use_gpu); cv::Stitcher::Status status = stitcher.stitch(imgs, out); //--------------------------------------------------------- return (status != cv::Stitcher::OK) ? 1 : 0;

 

#5. Result

Input images

input images  

Output image

output image   

 

arrow
arrow

    Cuby 56 發表在 痞客邦 留言(1) 人氣()