# Revision history [back]

### Can't get contours index array

Hello,

I am trying to find the 2 biggest contours, but I am facing some problems.

im2, contours, hierarchy = cv.findContours(roi, cv.RETR_TREE, cv.CHAIN_APPROX_NONE)
largest_area = 0
second_area = 0
l_index = 0
s_index = 0
for i, c in enumerate(contours):
area = cv.contourArea(c)
if (area > largest_area):
largest_area = area
l_index = i
elif (area > second_area):
second_area = area
s_index = i

cv.drawContours(frame, contours[l_index], -1, (0, 255, 0), 2)
cv.imshow('frame',frame)


I have tried to get the index of the 2 biggest contours' array, but it says:

cv.drawContours(frame, contours[l_index], -1, (0, 255, 0), 2)
IndexError: list index out of range


And, I would like to know, how could I draw (drawContours) both after get them? .

Thanks!