I have a list of contours(contours_list) which is np.shape(contours_list)= (5,519) and size of contours (in contours_list) are different, for example : index 0 1 2 3 4 size (8,1,2) (16,1,2) (3,1,2) (199,1,2) (9,1,2) respectively.
the objects in my image are filaments with different lengths. I want to remove for example the contours with :len(contours)>12 (which is the number of selected boundary points in filaments) This is my code:
df=pd.DataFrame(contours_list)
extract=np.array(())
selected_contours_list=[]
for i in range(5):
for j in range(519):
if len(df.loc[i][j])>=12:
extract=np.array(df.loc[i][j])
selected_contours_list.append(extract)
out_put: np.shape(selected_contours_list) : (1345,) which satisfies the condition! but I think there is sth wrong!! I can not understand what happens? Where are my 5 lists? I want to have the np.shape(selected_contours_list)(5, output)
index: 0 1 2 and size: (27, 1, 2) (28, 1, 2) (15, 1, 2) respectively.