当我尝试运行代码时,我收到以下错误,
#!/usr/bin/env python
from cv2 import *
import cv2
import utils
import detectvegetation
import segmentcolor
import detectpolygon
def main():
fname = 'Testing_3.png'
original = cv2.imread(fname)
utils.show_image(original, 'original')
img = utils.smooth(original, 'bilateral')
utils.show_image(img, 'bilateral filter')
# get image dimensions
xdim, ydim, nchannels = img.shape
veg_to_background = detectvegetation.detect(img, xdim, ydim)
segmented = segmentcolor.mask(veg_to_background, xdim, ydim)
detect = detectpolygon.detect(segmented, original, xdim, ydim)
cv2.imwrite(detect, '/Desktop/' + fname[:-4] + '-detect.png')
if __name__ == "__main__":
main()
错误:
TypeError:预期的字符串或Unicode对象,找到numpy.ndarray