I am trying to use cv2.distanceTransform()
method in Python. And I am getting an error when running the following line of code:
dist_transform = cv2.distanceTransform(opening,cv2.DIST_L2,5)
I get the following error when running this code:
AttributeError: 'module' object has no attribute 'DIST_L2'
Similar questions have been asked before, and i know that this problem occurs when you import 'something' when your python file name is 'something.py'. However, my python file name is segment3.py.
Can anyone please help me with this? I am trying to do segmentation using watershed algorithm. I am working on Fedora20. Thanks in advance!
Should be rewritten as below:
(dist_transform, labels) = cv2.distanceTransform(opening,cv2.cv.CV_DIST_L2,5)