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
Output image
文章標籤
全站熱搜