'How do I retrieve coordinates from a list containing other items?
So I have a list called 'masterStruc' which contains several items. I am also storing coordinates in this list for later use. However, when I try to retrieve the coordinates from the list I am getting a "TypeError: 'int' object is not subscriptable". Is there anyway I can get the values from the list without getting this error? In the list I have color, some contour data from the approxPolyDP function, the contour area and the x and y coordinates.
#masterStruc appends the relevant data
masterStruc.append([x, approxCurve, contArea, cX, cY])
for z in range(len(masterStruc)):
#Drawing contours on the source image
cv2.drawContours(srcImg, [masterStruc[z][1]], 0, drawColor[masterStruc[z][0]], 2)
cv2.circle(srcImg, masterStruc[z[3][4]], 5, (255, 255, 255), -1)
Any assistance is appreciated
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
