Why isn't triangulate points (for any arbitrary number of views and not just two views) part of the official opencv python bindings?

In the official opencv python bindings (which you get by executing pip install opencv-python), you only get cv2.triangulatePoints which only triangulates a 2d point from two views and not for any arbitrary number of views.

There is indeed a cv2.triangulatePoints function in the C++ implementation of opencv that takes the pose matrices of any number of views and the corresponding 2d point in each view as input and gives you the 3d point that corresponds to the 2d point in each of the views.

Why isn’t this part of the official opencv python release? Is there a bug in it? Please let me know since I am thinking of using it instead of the triangulation function from pymvg (which also works but I rather use as few external libraries as I could).

no, those were never “official” (they never maintained pip bindings in the past). however, this is unrelated to your problem.

where did you find this ?

here it is:

one function is a core function from the calib3d module.

the other function is in the sfm namespace, a contrib module.

>>> cv.sfm.triangulatePoints
<built-in function triangulatePoints>
>>> cv.triangulatePoints
<built-in function triangulatePoints>
>>> cv.triangulatePoints is cv.sfm.triangulatePoints

the opencv-python and contrib packages on PyPI are unofficial but well maintained. they might not contain the sfm module because it has a few other dependencies that may be tricky to build.

you’ll have to build OpenCV yourself if you want that function from python.

indeed ( opencv_contrib, even ! ). also make sure you have the relevant deps:

  • Ceres
  • Glog
  • GFlags

and don’t bother to hit “make”, unless cmake output has the sfm module listed in “To Be Built”

I understand that but why wasn’t it included in the official Python bindings? Is it buggy? Are there some problems in the function? That’s what I am curious about.

again, there are no binaries supplied from opencv.

and the pip buildbot simply does not have those deps, so the module is not included (not an error !)

((you probably also don’t have an “alphamat” (missing eigen lib) or a “viz” (depends on vtk) or an “oviz” (depends on ogre3d) module … )

no all problems are related to dependancies in the build process

1 Like