Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to filter mask results in python cv2

#This should probably help

contour, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
    
  for c in contour:
        area = cv2.contourArea(c)

        if area > 400:
            x, y, w, h = cv2.boundingRect(c)
            cv2.rectangle(frame, (x, y), (x + w, y + h), (255, 0, 0), 2)
            cv2.drawContours(frame, c, -1, (255, 0, 0), 2)
 
PREVIOUS NEXT
Tagged: #filter #mask #results #python
ADD COMMENT
Topic
Name
6+1 =