AttributeError:' builtin_function_or_method'对象没有属性' segment'

时间:2017-12-21 13:18:50

标签: python image-processing image-segmentation cv2 mean-shift

使用以下行中的meanshift算法面对图像分割中的错误:

import cv2
(segmented_image, labels_image, number_regions) = cv2.meanShift.segment(im, spatial_radius=6, range_radius=4.5, min_density=50)

完整的追溯是:

Traceback (most recent call last):
  File "image_processing.py", line 16, in <module>
    (segmented_image, labels_image, number_regions) = cv2.meanShift.segment(im,
spatial_radius=6,
AttributeError: 'builtin_function_or_method' object has no attribute 'segment'

1 个答案:

答案 0 :(得分:-1)

此错误告诉您cv2.meanShift不引用属性,而是引用函数/方法。你把它称之为财产。查看cv2的API,并确保使用正确的参数调用meanShift作为函数。