Merge pull request #1415 from znah:sfm_py

This commit is contained in:
Roman Donchenko 2013-09-10 11:37:04 +04:00 committed by OpenCV Buildbot
commit 7238479813
2 changed files with 20 additions and 3 deletions

View File

@ -262,16 +262,16 @@ CV_EXPORTS Mat findFundamentalMat( InputArray points1, InputArray points2,
double param1 = 3., double param2 = 0.99 ); double param1 = 3., double param2 = 0.99 );
//! finds essential matrix from a set of corresponding 2D points using five-point algorithm //! finds essential matrix from a set of corresponding 2D points using five-point algorithm
CV_EXPORTS Mat findEssentialMat( InputArray points1, InputArray points2, CV_EXPORTS_W Mat findEssentialMat( InputArray points1, InputArray points2,
double focal = 1.0, Point2d pp = Point2d(0, 0), double focal = 1.0, Point2d pp = Point2d(0, 0),
int method = RANSAC, double prob = 0.999, int method = RANSAC, double prob = 0.999,
double threshold = 1.0, OutputArray mask = noArray() ); double threshold = 1.0, OutputArray mask = noArray() );
//! decompose essential matrix to possible rotation matrix and one translation vector //! decompose essential matrix to possible rotation matrix and one translation vector
CV_EXPORTS void decomposeEssentialMat( InputArray E, OutputArray R1, OutputArray R2, OutputArray t ); CV_EXPORTS_W void decomposeEssentialMat( InputArray E, OutputArray R1, OutputArray R2, OutputArray t );
//! recover relative camera pose from a set of corresponding 2D points //! recover relative camera pose from a set of corresponding 2D points
CV_EXPORTS int recoverPose( InputArray E, InputArray points1, InputArray points2, CV_EXPORTS_W int recoverPose( InputArray E, InputArray points1, InputArray points2,
OutputArray R, OutputArray t, OutputArray R, OutputArray t,
double focal = 1.0, Point2d pp = Point2d(0, 0), double focal = 1.0, Point2d pp = Point2d(0, 0),
InputOutputArray mask = noArray() ); InputOutputArray mask = noArray() );

View File

@ -688,6 +688,23 @@ bool pyopencv_to(PyObject* obj, Point2f& p, const char* name)
return PyArg_ParseTuple(obj, "ff", &p.x, &p.y) > 0; return PyArg_ParseTuple(obj, "ff", &p.x, &p.y) > 0;
} }
template<>
bool pyopencv_to(PyObject* obj, Point2d& p, const char* name)
{
(void)name;
if(!obj || obj == Py_None)
return true;
if(!!PyComplex_CheckExact(obj))
{
Py_complex c = PyComplex_AsCComplex(obj);
p.x = saturate_cast<double>(c.real);
p.y = saturate_cast<double>(c.imag);
return true;
}
return PyArg_ParseTuple(obj, "dd", &p.x, &p.y) > 0;
}
template<> template<>
PyObject* pyopencv_from(const Point& p) PyObject* pyopencv_from(const Point& p)
{ {