I am working on several lines of images in Visual Studio 2012, C ++. I changed stitching_detailed.cpp as per my requirement and gave quality results. The problem here is that it takes too much time to complete. For 10 image requires about 110 seconds .
Here where it takes most of the time:
1) Pair match - takes 55 seconds for 10 images! I use ORB to find function points. Here is the code:
vector<MatchesInfo> pairwise_matches;
BestOf2NearestMatcher matcher(false, 0.35);
matcher(features, pairwise_matches);
matcher.collectGarbage();
I tried to use this code, since I already know the sequence of images:
vector<MatchesInfo> pairwise_matches;
BestOf2NearestMatcher matcher(false, 0.35);
Mat matchMask(features.size(),features.size(),CV_8U,Scalar(0));
for (int i = 0; i < num_images -1; ++i)
matchMask.at<char>(i,i+1) =1;
matcher(features, pairwise_matches, matchMask);
matcher.collectGarbage();
(18 ), . 6 ( 4 , 6 7 - . .)
2) - 38 10 ! :
for (int img_idx = 0; img_idx < num_images; ++img_idx)
{
printf("Compositing image #%d\n",indices[img_idx]+1);
full_img = imread(img_names[img_idx]);
Mat K;
cameras[img_idx].K().convertTo(K, CV_32F);
warper->warp(full_img, K, cameras[img_idx].R, INTER_LINEAR, BORDER_REFLECT, img_warped);
mask.create(full_img.size(), CV_8U);
mask.setTo(Scalar::all(255));
warper->warp(mask, K, cameras[img_idx].R, INTER_NEAREST, BORDER_CONSTANT, mask_warped);
compensator->apply(img_idx, corners[img_idx], img_warped, mask_warped);
img_warped.convertTo(img_warped_s, CV_16S);
img_warped.release();
full_img.release();
mask.release();
dilate(masks_warped[img_idx], dilated_mask, Mat());
resize(dilated_mask, seam_mask, mask_warped.size());
mask_warped = seam_mask & mask_warped;
blender->feed(img_warped_s, mask_warped, corners[img_idx]);
}
Mat result, result_mask;
blender->blend(result, result_mask);
- 4160 * 3120. , . .
, . .
3) - ORB. 10 10 . 1530 .
55 + 38 + 10 = 103 + 7 = 110.
android, () . , Android? (Android-, , 2 )
. !
1: , 38 16 . .
, 110 → 85 . ; , !
EDIT 2: matchers.cpp. , . , . , . 50 .