C ++ openCV видео на панораму

Я пытаюсь создать панораму из видео, соединяя кадр n-1 с кадром n.
Моя проблема в том, что после (около 20 кадров) правая сторона картинки становится очень размытой, и я не знаю, что с ней делать.

главный:

  frames = getVideoFrames();
stichPair(frames[1], frames[0], panorama[0]);
for (int i = 2; i < SIZE; i++)
{
stichPair(frames[i], panorama[i - 2], panorama[i - 1]);
printf("%d\n", i);
}

cvNamedWindow(windowsName1, 1);
on_trackbar(index, 0);
createTrackbar("MyTrackbar:", windowsName1, &index, SIZE - 2, on_trackbar);

stichPair:

Ptr<FeatureDetector> brisk = BRISK::create(20, 3, 1.0f);
Ptr<DescriptorMatcher> matcher = BFMatcher::create("BruteForce-Hamming");
// find features
brisk->detect(leftImage, keypoints_1);
brisk->detect(rightImage, keypoints_2);
brisk->compute(leftImage, keypoints_1, descriptors_1);
brisk->compute(rightImage, keypoints_2, descriptors_2);

// Find two nearest matches
matcher->knnMatch(descriptors_1, descriptors_2, matches, 2);

//filter bad matches
const float ratio = 0.6;
for (int i = 0; i < matches.size(); ++i)
{
if (matches[i][0].distance / matches[i][1].distance < ratio)
{
good_matches.push_back(matches[i][0]);
}
}

for (size_t i = 0; i < good_matches.size(); i++)
{
leftImage_matchedKPs.push_back(keypoints_1[good_matches[i].queryIdx].pt);
rightImage_matchedKPs.push_back(keypoints_2[good_matches[i].trainIdx].pt);
}

H = findHomography(Mat(rightImage_matchedKPs), Mat(leftImage_matchedKPs), RANSAC, 5);
warpPerspective(rightImage, rightImageWarped, H, Size(4000, 1280)); // fixed size

panorama = rightImageWarped.clone();
roi = Mat(panorama, Rect(0, 0, leftImage.cols, leftImage.rows));
leftImage.copyTo(roi);
}

после 20 кадров

после 40 кадров

1

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …