Robotics StackExchange | Archived questions

image_geometry PinholeCameraModel Python not importing properly when installed using debian package

I'm running Indigo (with catkin) on Ubuntu 14, and I'm trying to use the image_geometry package in Python(without roslib). When I import the package and try to instantiate a PinholeCameraModel object, it errors out and says: AttributeError: 'module' object has no attribute 'PinholeCameraModel'. Here is the full error.

I have image_geometry installed from apt-get, and my package.xml has both build_depend and run_depend for the image_geometry package. My code is below:

#!/usr/bin/env python
import rospy
import image_geometry

if __name__ == '__main__':
    rospy.init_node('blabla_node')
    cam_model = image_geometry.PinholeCameraModel()

    rospy.spin()

My end goal is to run projectPixelTo3dRay() on image pixels and find their intersection with the ground plane.

I ran a Python shell session and tried dir(image_geometry) and it only displayed this: ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__']. I'm assuming this means it hasn't imported it properly.

Below is my PYTHONPATH in case it matters (I even added the path of image_geometry to it):

/opt/ros/indigo/lib/python2.7/dist-packages/image_geometry:/home/basheersubei/edt_ws/devel/lib/python2.7/dist-packages:/home/basheersubei/edt/new_ws/devel/lib/python2.7/dist-packages:/opt/ros/indigo/lib/python2.7/dist-packages

What am I doing wrong? Can someone provide an example on how to instantiate a PinholeCameraModel object? The only example I found here is where I got this from and it doesn't work.

EDIT I installed image_geometry from source and it worked just fine now... Even running dir(image_geometry) in Python shows the PinholeCameraModel correctly... I'm so baffled. Should I file a bug report? Does anyone else have this issue?

EDIT 2 I just tried this on another Ubuntu 14 machine (same setup) and it seems to work from the debian package... No idea what's going on...

Asked by basheersubei on 2015-05-26 18:19:05 UTC

Comments

I have the same issue: https://github.com/ros-perception/vision_opencv/issues/182

How did you compile from source? Just image_geometry or the whole vision_opencv package?

Asked by SimonB on 2017-07-12 11:23:04 UTC

This was ages ago, so I'm not sure but I think it was just image_geometry package. Good luck! :)

Asked by basheersubei on 2017-07-12 11:55:30 UTC

Answers

Compile the whole vision_opencv package from source and it works:

https://github.com/ros-perception/vision_opencv/issues/182

Presumably this will get fixed in the fullness of time.

Asked by SimonB on 2017-07-17 07:34:16 UTC

Comments