Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to clean a mask cv2 in python

#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: #clean #mask #python
ADD COMMENT
Topic
Name
9+9 =