Ask Your Question

DIST_L2 missing in version 2.4.8? (segmentation demo fails)

asked 2016-04-03 19:49:03 -0600

dcconner gravatar image

updated 2016-04-04 02:46:10 -0600

berak gravatar image

I'm using version 2.4.8 that it is installed as part of the ROS Jade distribution.

I am trying to follow the image segmentation demo, and get the following error. dist_transform = cv2.distanceTransform(opening, cv2.DIST_L2, 5) AttributeError: 'module' object has no attribute 'DIST_L2'

I used

for key in cv2.__dict__.keys():
    print key

and DIST_L2 was not there. I tried substituting NORM_L2 but that failed to give an output.

edit retag flag offensive close merge delete


See also older question 30689 that was never answered

dcconner gravatar imagedcconner ( 2016-04-03 19:50:39 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-04-04 02:45:33 -0600

berak gravatar image

updated 2016-04-04 02:49:29 -0600

for older cv2 versions, like opencv2.4.8, you will probably have to fall back to

(,, so, a different enum value)

edit flag offensive delete link more



also, just saying, those ROS folks seem to have a knack for packing outdated opencv distributions, which very often leads to trouble..

berak gravatar imageberak ( 2016-04-04 02:55:42 -0600 )edit

it is not like they just want to do it so to annoy people. In order to get ROS to be installable using sudo apt-get, all the dependencies should also exist as repositories. For Ubuntu 14.04, opencv 3 is not there yet. So this is a Canonical and OpenCV folks problem.

Mehdi gravatar imageMehdi ( 2016-04-04 03:49:14 -0600 )edit

@Mehdi, ofc, youre right, apologies for the grumpy remark above.

berak gravatar imageberak ( 2016-04-04 03:59:47 -0600 )edit

Question Tools

1 follower


Asked: 2016-04-03 19:49:03 -0600

Seen: 1,390 times

Last updated: Apr 04 '16