1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Warning fixes continued

This commit is contained in:
Andrey Kamaev
2012-06-09 15:00:04 +00:00
parent f6b451c607
commit f2d3b9b4a1
127 changed files with 6298 additions and 6277 deletions
+4 -4
View File
@@ -72,10 +72,10 @@ struct MatchPairsBody
: matcher(other.matcher), features(other.features),
pairwise_matches(other.pairwise_matches), near_pairs(other.near_pairs) {}
MatchPairsBody(FeaturesMatcher &matcher, const vector<ImageFeatures> &features,
vector<MatchesInfo> &pairwise_matches, vector<pair<int,int> > &near_pairs)
: matcher(matcher), features(features),
pairwise_matches(pairwise_matches), near_pairs(near_pairs) {}
MatchPairsBody(FeaturesMatcher &_matcher, const vector<ImageFeatures> &_features,
vector<MatchesInfo> &_pairwise_matches, vector<pair<int,int> > &_near_pairs)
: matcher(_matcher), features(_features),
pairwise_matches(_pairwise_matches), near_pairs(_near_pairs) {}
void operator ()(const BlockedRange &r) const
{
+13 -13
View File
@@ -50,7 +50,7 @@ namespace {
struct IncDistance
{
IncDistance(vector<int> &dists) : dists(&dists[0]) {}
IncDistance(vector<int> &vdists) : dists(&vdists[0]) {}
void operator ()(const GraphEdge &edge) { dists[edge.to] = dists[edge.from] + 1; }
int* dists;
};
@@ -58,8 +58,8 @@ struct IncDistance
struct CalcRotation
{
CalcRotation(int num_images, const vector<MatchesInfo> &pairwise_matches, vector<CameraParams> &cameras)
: num_images(num_images), pairwise_matches(&pairwise_matches[0]), cameras(&cameras[0]) {}
CalcRotation(int _num_images, const vector<MatchesInfo> &_pairwise_matches, vector<CameraParams> &_cameras)
: num_images(_num_images), pairwise_matches(&_pairwise_matches[0]), cameras(&_cameras[0]) {}
void operator ()(const GraphEdge &edge)
{
@@ -195,10 +195,10 @@ void BundleAdjusterBase::estimate(const vector<ImageFeatures> &features,
// Compute number of correspondences
total_num_matches_ = 0;
for (size_t i = 0; i < edges_.size(); ++i)
total_num_matches_ += static_cast<int>(pairwise_matches[edges_[i].first * num_images_ +
total_num_matches_ += static_cast<int>(pairwise_matches[edges_[i].first * num_images_ +
edges_[i].second].num_inliers);
CvLevMarq solver(num_images_ * num_params_per_cam_,
CvLevMarq solver(num_images_ * num_params_per_cam_,
total_num_matches_ * num_errs_per_measurement_,
term_criteria_);
@@ -270,7 +270,7 @@ void BundleAdjusterReproj::setUpInitialCameraParams(const vector<CameraParams> &
svd(cameras[i].R, SVD::FULL_UV);
Mat R = svd.u * svd.vt;
if (determinant(R) < 0)
if (determinant(R) < 0)
R *= -1;
Mat rvec;
@@ -392,7 +392,7 @@ void BundleAdjusterReproj::calcJacobian(Mat &jac)
calcDeriv(err1_, err2_, 2 * step, jac.col(i * 7));
cam_params_.at<double>(i * 7, 0) = val;
}
if (refinement_mask_.at<uchar>(0, 2))
if (refinement_mask_.at<uchar>(0, 2))
{
val = cam_params_.at<double>(i * 7 + 1, 0);
cam_params_.at<double>(i * 7 + 1, 0) = val - step;
@@ -402,7 +402,7 @@ void BundleAdjusterReproj::calcJacobian(Mat &jac)
calcDeriv(err1_, err2_, 2 * step, jac.col(i * 7 + 1));
cam_params_.at<double>(i * 7 + 1, 0) = val;
}
if (refinement_mask_.at<uchar>(1, 2))
if (refinement_mask_.at<uchar>(1, 2))
{
val = cam_params_.at<double>(i * 7 + 2, 0);
cam_params_.at<double>(i * 7 + 2, 0) = val - step;
@@ -448,7 +448,7 @@ void BundleAdjusterRay::setUpInitialCameraParams(const vector<CameraParams> &cam
svd(cameras[i].R, SVD::FULL_UV);
Mat R = svd.u * svd.vt;
if (determinant(R) < 0)
if (determinant(R) < 0)
R *= -1;
Mat rvec;
@@ -546,7 +546,7 @@ void BundleAdjusterRay::calcError(Mat &err)
double mult = sqrt(f1 * f2);
err.at<double>(3 * match_idx, 0) = mult * (x1 - x2);
err.at<double>(3 * match_idx + 1, 0) = mult * (y1 - y2);
err.at<double>(3 * match_idx + 2, 0) = mult * (z1 - z2);
err.at<double>(3 * match_idx + 2, 0) = mult * (z1 - z2);
match_idx++;
}
@@ -728,7 +728,7 @@ vector<int> leaveBiggestComponent(vector<ImageFeatures> &features, vector<Match
continue;
int comp1 = comps.findSetByElem(i);
int comp2 = comps.findSetByElem(j);
if (comp1 != comp2)
if (comp1 != comp2)
comps.mergeSets(comp1, comp2);
}
}
@@ -739,7 +739,7 @@ vector<int> leaveBiggestComponent(vector<ImageFeatures> &features, vector<Match
vector<int> indices_removed;
for (int i = 0; i < num_images; ++i)
if (comps.findSetByElem(i) == max_comp)
indices.push_back(i);
indices.push_back(i);
else
indices_removed.push_back(i);
@@ -761,7 +761,7 @@ vector<int> leaveBiggestComponent(vector<ImageFeatures> &features, vector<Match
LOG("Removed some images, because can't match them or there are too similar images: (");
LOG(indices_removed[0] + 1);
for (size_t i = 1; i < indices_removed.size(); ++i)
for (size_t i = 1; i < indices_removed.size(); ++i)
LOG(", " << indices_removed[i]+1);
LOGLN(").");
LOGLN("Try to decrease --match_conf value and/or check if you're stitching duplicates.");
+9 -9
View File
@@ -168,20 +168,20 @@ Stitcher::Status Stitcher::composePanorama(InputArray images, OutputArray pano)
}
// Warp images and their masks
Ptr<detail::RotationWarper> warper = warper_->create(float(warped_image_scale_ * seam_work_aspect_));
Ptr<detail::RotationWarper> w = warper_->create(float(warped_image_scale_ * seam_work_aspect_));
for (size_t i = 0; i < imgs_.size(); ++i)
{
Mat_<float> K;
cameras_[i].K().convertTo(K, CV_32F);
K(0,0) *= (float)seam_work_aspect_;
K(0,0) *= (float)seam_work_aspect_;
K(0,2) *= (float)seam_work_aspect_;
K(1,1) *= (float)seam_work_aspect_;
K(1,1) *= (float)seam_work_aspect_;
K(1,2) *= (float)seam_work_aspect_;
corners[i] = warper->warp(seam_est_imgs_[i], K, cameras_[i].R, INTER_LINEAR, BORDER_REFLECT, images_warped[i]);
corners[i] = w->warp(seam_est_imgs_[i], K, cameras_[i].R, INTER_LINEAR, BORDER_REFLECT, images_warped[i]);
sizes[i] = images_warped[i].size();
warper->warp(masks[i], K, cameras_[i].R, INTER_NEAREST, BORDER_CONSTANT, masks_warped[i]);
w->warp(masks[i], K, cameras_[i].R, INTER_NEAREST, BORDER_CONSTANT, masks_warped[i]);
}
vector<Mat> images_warped_f(imgs_.size());
@@ -232,7 +232,7 @@ Stitcher::Status Stitcher::composePanorama(InputArray images, OutputArray pano)
// Update warped image scale
warped_image_scale_ *= static_cast<float>(compose_work_aspect);
warper = warper_->create((float)warped_image_scale_);
w = warper_->create((float)warped_image_scale_);
// Update corners and sizes
for (size_t i = 0; i < imgs_.size(); ++i)
@@ -252,7 +252,7 @@ Stitcher::Status Stitcher::composePanorama(InputArray images, OutputArray pano)
Mat K;
cameras_[i].K().convertTo(K, CV_32F);
Rect roi = warper->warpRoi(sz, K, cameras_[i].R);
Rect roi = w->warpRoi(sz, K, cameras_[i].R);
corners[i] = roi.tl();
sizes[i] = roi.size();
}
@@ -268,12 +268,12 @@ Stitcher::Status Stitcher::composePanorama(InputArray images, OutputArray pano)
cameras_[img_idx].K().convertTo(K, CV_32F);
// Warp the current image
warper->warp(img, K, cameras_[img_idx].R, INTER_LINEAR, BORDER_REFLECT, img_warped);
w->warp(img, K, cameras_[img_idx].R, INTER_LINEAR, BORDER_REFLECT, img_warped);
// Warp the current image mask
mask.create(img_size, CV_8U);
mask.setTo(Scalar::all(255));
warper->warp(mask, K, cameras_[img_idx].R, INTER_NEAREST, BORDER_CONSTANT, mask_warped);
w->warp(mask, K, cameras_[img_idx].R, INTER_NEAREST, BORDER_CONSTANT, mask_warped);
// Compensate exposure
exposure_comp_->apply((int)img_idx, corners[img_idx], img_warped, mask_warped);