TypeError:期望的字符串或Unicode对象,找到numpy.ndarray

时间:2018-01-08 10:47:12

标签: opencv python-2.x

当我尝试运行代码时,我收到以下错误,

#!/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

0 个答案:

没有答案