我正在尝试用python3.5开发一个xy-cut算法,它非常棒,直到我出现一个错误
TypeError: string indices must be integers
在
I1=img[:,1:cutPoint-1:1,:]
看起来cutPoint
是作为字符串读取的,但我确保将它转换为整数,并使用print
验证它的类型和它是一个整数,我不知道问题是什么以及如何解决它。你知道吗
这是我代码的一部分:
if maxValLine<10 and maxValCol<10:
result=img
else:
#determiner coupe selon x ou y
if maxValLine>maxValCol:
cutpoint=(locsLine[indexLine]+locsLine[indexLine+1])/2
cutPoint=math.floor(cutPoint)
print(cutpoint) #it shows the value 303
print(type(cutPoint)) #gives <class 'int'>
I1=img[1:cutPoint-1:1,:,:] !!!the issue is here
I2=img[cutPoint:end:1,:,:]
cv2.imshow('I1',I1)
cv2.imshow('I2',I2)
result=[recusiveCut(I1),recusiveCut(I2)]
return result
目前没有回答
相关问题 更多 >
编程相关推荐