OpenCV Stitcher库正在输出压缩图像

时间:2015-05-05 23:41:14

标签: c++ opencv image-processing image-stitching opencv-stitching

我正在制作一个将无人机图像拼接在一起的程序,我似乎无法获得任何可以在网上找到工作的拼接方法。最值得注意的是openCV具有的简单Stitcher类。这些是我的两个输入图像是最后两个,结果是第一个图像

http://imgur.com/a/JyJiN

所以很明显这是不对的,但我不知道我哪里出错了,因为这只是对缝合器的简单调用。

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

// Load the images
//Mat image1 = imread(argv[2]);
//Mat image2 = imread(argv[1]);

VideoCapture cap("vid.mp4");

vector<Mat> Vimg;
Mat result;

cout << "Grabbing Images" << endl;
for (int i = 0; i < 3; i++)
{
    cout << "Grabbing Frame" << i << endl;
    Mat temp;
    cap.read(temp);
    Vimg.push_back(temp);
    imwrite("image" + to_string(i) + ".jpg", temp);
    for (int j = 0; j < 80; j++)
        cap.grab();
}

Stitcher stitch = Stitcher::createDefault();
cout << "Starting Stitching" << endl;
stitch.stitch(Vimg, result);

imwrite("result.jpg", result);

}

0 个答案:

没有答案