【发布时间】:2021-03-05 19:40:45
【问题描述】:
我正在尝试这段代码
from PIL import Image
import numpy as np
from lsd import *
import cv2
im = cv2.imread('/home/lenovo/Downloads/python-lsd-master/test_data/chairs.pgm')
#fullName = '1.jpg'
folder, imgName = os.path.split(im)
src = cv2.imread(im, cv2.IMREAD_COLOR)
gray = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)
lines =lsd.__module__
#path1=os.path.normpath('/home/lenovo/pylsd/example/751626ntl.txt')
for i in range(lines.shape[0]):
pt1 = (int(lines[i, 0]), int(lines[i, 1]))
pt2 = (int(lines[i, 2]), int(lines[i, 3]))
width = lines[i, 4]
cv2.line(src, pt1, pt2, (0, 0, 255), int(np.ceil(width / 2)))
cv2.imwrite(os.path.join(folder, 'cv2_' + imgName.split('.')[0] + '.jpg'), src)
ValueError: TypeError: 预期的 str、bytes 或 os.PathLike 对象,而不是 numpy.ndarray
你能帮忙吗
【问题讨论】:
-
请格式化您的信息
标签: python python-3.x python-2.7 python-requests