I trying to find all triangle in image with that code without success
import numpy as np
import cv2
img = cv2.imread('2.jpg')
for gray in cv2.split(img):
canny = cv2.Canny(gray,50,200)
contours,hier = cv2.findContours(canny,1,2)
for cnt in contours:
approx = cv2.approxPolyDP(cnt,0.02*cv2.arcLength(cnt,True),True)
if len(approx)==3:
cv2.drawContours(img,[cnt],0,(0,255,0),2)
tri = approx
for vertex in tri:
cv2.circle(img,(vertex[0][0],vertex[0][1]),5,255,-1)
cv2.imshow('img',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
So from this picture

I want get this ( Look at licence plate, I filled with red lines triangles)

That what I get now

trikeeps getting replaced when you detect three vertices for each polygon. Perhaps you should make a list and append these results whenlen(approx) == 3.