使用以下行中的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'
答案 0 :(得分:-1)
此错误告诉您cv2.meanShift
不引用属性,而是引用函数/方法。你把它称之为财产。查看cv2
的API,并确保使用正确的参数调用meanShift
作为函数。