こんにちは、opencv が提供するステッチ クラスを使用せずにいくつかの画像をステッチしようとしています。しかし、出力は予想外です。入出力イメージで説明します。
入力1
入力2
期待される出力
実際の出力
ROI のコピーに問題があると思います。誰でも助けてください!!!
ステッチ部分の私のコードは次のとおりです-
std::vector< Point2f > points1,points2;
for( int i = 0; i < matches1.size(); i++ )
{
points1.push_back( keypoints_input1[matches1[i].queryIdx ].pt );
points2.push_back( keypoints_input2[matches1[i].trainIdx ].pt );
}
/* Find the Homography Matrix for current and next frame*/
Mat H1 = findHomography( points2, points1, CV_RANSAC );
/* Use the Homography Matrix to warp the images*/
cv::Mat result1;
warpPerspective(input2, result1, H1, Size(input2.cols+150, input2.rows+150), INTER_CUBIC);
Mat stitch_1(Size(input2.cols+150, input2.rows+150),CV_8UC3);
Mat roi1(stitch_1, Rect(0, 0, input1.cols, input1.rows));
Mat roi2(stitch_1, Rect(0, 0, result1.cols, result1.rows));
input2.copyTo(roi1);
result1.copyTo(roi2);
どこが間違っているのか誰にも教えてもらえますか? ありがとう。
編集: input1(640,360) と input2(790,510) はサイズが異なります。