Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How can I add my own feature code into sticther pipeline of OpenCV?

I have a hard stitching problem therfore I need to define my own feature extraction routine instead of native SURF or other.

The main problem is, my images are symmetric to each other. Therefore, matching features are also symmetric that skwed the expected homography estimation. Hence I need to define the region that suposedly used in feature extraction. I also believe Lowe's SIFT is better than the SURF so I need to define my feature extraction routine using SIFT on a given area of the images.

How can I inject my own feature extraction routine, for instance well-known SIFT implementation of DAVID LOWE, instead of SURF at the below code that I work on ?

vector<Mat> images;
images.push_back(imread("images/isvec_left.jpg"));
images.push_back(imread("images/iscev_right.jpg"));

Mat pano;
Stitcher stitcher = Stitcher::createDefault(true);

stitcher.setWarper(new PlaneWarper());
stitcher.setFeaturesFinder(new detail::SurfFeaturesFinder(1000,4,4,4,4));
stitcher.setRegistrationResol(0.1);
stitcher.setSeamEstimationResol(0.1);
stitcher.setCompositingResol(1);
stitcher.setPanoConfidenceThresh(1);
stitcher.setWaveCorrection(true);
stitcher.setWaveCorrectKind(detail::WAVE_CORRECT_HORIZ);
stitcher.setFeaturesMatcher(new detail::BestOf2NearestMatcher(false,0.3));
stitcher.setBundleAdjuster(new detail::BundleAdjusterRay());
Stitcher::Status status = Stitcher::ERR_NEED_MORE_IMGS;
try{
    status = stitcher.stitch(images, pano);
    cout << status << endl;
}
catch(cv::Exception e){
    cout << "Stitching is not successfull!!" << endl;
}
imwrite("RESULT.jpg", pano);