Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unregistered type" error you're encountering when using Ceres Solver with PyCOLMAP #51

Open
vholod opened this issue Jul 28, 2024 · 6 comments

Comments

@vholod
Copy link

vholod commented Jul 28, 2024

Hi,
I get the following error when I try to run the test_BA.ipynb notebook in the examples.

TypeError: Unregistered type : ceres::AutoDiffCostFunction<colmap::ReprojErrorConstantPoseCostFunctioncolmap::SimplePinholeCameraModel, 2, 3, 3>

I installed the colmap and pycolmap from source.
Thus error I get when I install pyceres with pip install pyceres (version 2.2) or when I install pyceres from source (somehow the version is 2.0).

Please help me to solve the issue.
Thanks

@B1ueber2y
Copy link
Member

Likely due to #52. This has been fixed now. We may want to make a new release ASAP and add docs somewhere (on pycolmap 3.10 needs the new ceres release) @sarlinpe

@sarlinpe
Copy link
Member

sarlinpe commented Aug 2, 2024

@vholod could you try building pyceres at HEAD? we've also pushed a new release v2.3, does this work too when pulled from pypi?

@vholod
Copy link
Author

vholod commented Aug 4, 2024

Hi,
Thanks for your responses.
I now have many problems to install pyceres from source. I will try to progress with it.

However, when I install pyceres with pip (version 2.3), I still get the problem below.


TypeError Traceback (most recent call last)
TypeError: Unregistered type : ceres::AutoDiffCostFunction<colmap::ReprojErrorConstantPoseCostFunctioncolmap::SimplePinholeCameraModel, 2, 3, 3>

The above exception was the direct cause of the following exception:

TypeError Traceback (most recent call last)
Cell In[6], line 2
1 rec = create_reconstruction()
----> 2 problem = define_problem(rec)
3 solve(problem)

Cell In[5], line 7, in define_problem(rec)
5 cam = rec.cameras[im.camera_id]
6 for p in im.points2D:
----> 7 cost = pycolmap.cost_functions.ReprojErrorCost(
8 cam.model, im.cam_from_world, p.xy
9 )
10 prob.add_residual_block(
11 cost, loss, [rec.points3D[p.point3D_id].xyz, cam.params]
12 )
13 for cam in rec.cameras.values():

TypeError: Unable to convert function return value to a Python type! The signature was
(camera_model_id: pycolmap.CameraModelId, cam_from_world: pycolmap.Rigid3d, point2D: numpy.ndarray[numpy.float64[2, 1]]) -> ceres::CostFunction

@sarlinpe
Copy link
Member

pyceres and pycolmap need to be either both installed from source or both installed from pypi.

@yyfz
Copy link

yyfz commented Nov 25, 2024

@vholod Hi! I have the same problem, have you solved it?

@vholod
Copy link
Author

vholod commented Nov 25, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants