【发布时间】:2018-03-13 16:57:27
【问题描述】:
我想改变下一个轮廓的宽度值。我试图这样做,但事实证明它仍然保留了轮廓的原始值。我该怎么做呢?提前谢谢你。
更新:这是我正在处理的实际代码。
temp = 0; #Holds the last element we iterated replaced value
for i,c in enumerate(contours2):
[x, y, w, h] = cv2.boundingRect(contours2[i])
if i in percentiles: #if the current index is in the percentiles array
[i, j, k, l] = cv2.boundingRect(contours2[temp]) #Get contour values of element to overwrite
k = (x+w)-i
temp=i+1;
#DRAW
for c in contours2: #when I draw it the k value of the overwritten elements doesn't change,why?
[x, y, w, h] = cv2.boundingRect(c)
cv2.rectangle(image, (x, y), (x + w, y + h), (255, 0, 0), 2)
【问题讨论】:
-
你能更明确地说明你想做什么吗?您的代码目前对我没有意义。每个循环的值都会被重写。
标签: python opencv opencv-contour