嗨我试图用opencv缝合图像,但它不能正常工作,它会在一段时间内保存黑色图片或扭曲的图像。我如何完美匹配图像并缝合它
JNIEXPORT int JNICALL Java_org_opencv_samples_cameracalibration_Sample3Native_FindFeatures( JNIEnv *,jobject,jlong im1,jlong im2,jlong im3,jint no_images, Mat img1,Mat imgz){
vector<Mat> imgs;
bool try_use_gpu = false;
// New testing
Mat& temp1 = *((Mat*) im1);
Mat& temp2 = *((Mat*) im2);
Mat& pano = *((Mat*) im3);
Mat img = cvLoadImage("/storage/sdcard0/panoTmpImage/im0.jpeg", 1);
Mat img2 = cvLoadImage("/storage/sdcard0/panoTmpImage/im1.jpeg", 1);
Mat img3 = cvLoadImage("/storage/sdcard0/panoTmpImage/im2.jpeg", 1);
Mat img4 = cvLoadImage("/storage/sdcard0/panoTmpImage/im3.jpeg", 1);
if (!img.data) {
waitKey(5000);
return -1;
}
imgs.push_back(img);
imgs.push_back(img2);
imgs.push_back(img3);
imgs.push_back(img4);
if (!img.empty()) {
Stitcher stitcher = Stitcher::createDefault();
Stitcher::Status status = stitcher.stitch(imgs, pano);
if (status != Stitcher::OK) {
cout << "Can't stitch images, error code = " << int(status) << endl;
return -1;
}
} else {
return -2;
}
return 3;
}
}