Comment nettoyer un masque CV2 en 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)
Code Sir