#include<opencv2/opencv.hpp>
void test(const std::string& rootPath){
std::vector<cv::Mat> images(size);
for (int i = 0; i < size; ++i) {
images[i] = cv::imread(rootPath + std::to_string(i + 1) + ".jpg");
}
cv::Mat pano;
cv::Ptr<cv::Stitcher> stitcher = cv::Stitcher::create();
cv::Stitcher::Status status = stitcher->stitch(images, pano);
if (status != cv::Stitcher::OK) {
std::cout << "Can't stitch images, error code = " << int(status) << std::endl;
return -1;
}
std::vector<cv::detail::CameraParams> param = stitcher->cameras();
std::string result_name = rootPath + "pano.jpg";
cv::imwrite(result_name, pano);
cv::imshow(result_name, pano);
cv::waitKey(0);
}