pycolmap icon indicating copy to clipboard operation
pycolmap copied to clipboard

pycolmap.Image constructor fails in 0.2.0

Open mherb opened this issue 3 years ago • 1 comments
trafficstars

Hi,

I observed an error that occurs for me when constructing an Image object manually:

import pycolmap

points = [pycolmap.Point2D((100, 200))]
pts = pycolmap.ListPoint2D(points)
image = pycolmap.Image("image.png", pts)

In 0.1.0 this used to work fine, while in 0.2.0 it raises the following error:

Traceback (most recent call last):
  File "image_construct.py", line 5, in <module>
    image = pycolmap.Image("image.png", pts)
RecursionError: maximum recursion depth exceeded while calling a Python object

Note that when default-constructing the object without point list it also works fine.

Environment: Python 3.8 on Ubuntu 20.04, pycolmap 0.2.0 installed from PyPi

mherb avatar May 16 '22 15:05 mherb

Hi, the problem is that pybind fails to resolve the constructor here. You can either serve the points via the keyword argument:

image = pycolmap.Image("image.png", points2D=pts)

or use the much simpler auto conversion:

import pycolmap
image = pycolmap.Image("image.png", keypoints=[(100,200)])
# or
image = pycolmap.Image("image.png", [(100,200)])

On branch fix-image-constructor I pushed a fix which should also resolve your issue.

Phil26AT avatar May 19 '22 09:05 Phil26AT