refactored stitching module

This commit is contained in:
Alexey Spizhevoy
2011-09-05 11:52:30 +00:00
parent 9be4701f24
commit fbe2e6fb01
9 changed files with 207 additions and 235 deletions

View File

@@ -42,11 +42,24 @@
#include "precomp.hpp"
using namespace std;
using namespace cv;
namespace cv
namespace
{
template<typename _Tp> static inline bool
decomposeCholesky(_Tp* A, size_t astep, int m)
{
if (!Cholesky(A, astep, m, 0, 0, 0))
return false;
astep /= sizeof(A[0]);
for (int i = 0; i < m; ++i)
A[i*astep + i] = (_Tp)(1./A[i*astep + i]);
return true;
}
} // namespace
void focalsFromHomography(const Mat& H, double &f0, double &f1, bool &f0_ok, bool &f1_ok)
void cv::focalsFromHomography(const Mat& H, double &f0, double &f1, bool &f0_ok, bool &f1_ok)
{
CV_Assert(H.type() == CV_64F && H.size() == Size(3, 3));
@@ -77,8 +90,8 @@ void focalsFromHomography(const Mat& H, double &f0, double &f1, bool &f0_ok, boo
}
void estimateFocal(const vector<ImageFeatures> &features, const vector<MatchesInfo> &pairwise_matches,
vector<double> &focals)
void cv::estimateFocal(const vector<ImageFeatures> &features, const vector<MatchesInfo> &pairwise_matches,
vector<double> &focals)
{
const int num_images = static_cast<int>(features.size());
focals.resize(num_images);
@@ -118,22 +131,7 @@ void estimateFocal(const vector<ImageFeatures> &features, const vector<MatchesIn
}
namespace
{
template<typename _Tp> static inline bool
decomposeCholesky(_Tp* A, size_t astep, int m)
{
if (!Cholesky(A, astep, m, 0, 0, 0))
return false;
astep /= sizeof(A[0]);
for (int i = 0; i < m; ++i)
A[i*astep + i] = (_Tp)(1./A[i*astep + i]);
return true;
}
} // namespace
bool calibrateRotatingCamera(const vector<Mat> &Hs, Mat &K)
bool cv::calibrateRotatingCamera(const vector<Mat> &Hs, Mat &K)
{
int m = static_cast<int>(Hs.size());
CV_Assert(m >= 1);
@@ -183,5 +181,3 @@ bool calibrateRotatingCamera(const vector<Mat> &Hs, Mat &K)
K = W.t();
return true;
}
} // namespace cv