Search
 
SCRIPT & CODE EXAMPLE
 

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)
Comment

PREVIOUS NEXT
Code Example
Python :: python check if string is number 
Python :: how to print dataframe in python without index 
Python :: sorted python lambda 
Python :: flask hello world 
Python :: arithmetic python string 
Python :: python print exception 
Python :: how to move a column to last in pandas 
Python :: return column of matrix numpy 
Python :: intersection in list 
Python :: python for loop with array 
Python :: how to receive user input in python 
Python :: how to download a file in python using idm 
Python :: python create and show screenshot 
Python :: how to convert string to function name in python 
Python :: torch save 
Python :: create np nan array 
Python :: regex in python to obtain only the string in python 
Python :: decode base64 with python 
Python :: capitalize first letter in python 
Python :: vscode not recognizing python import 
Python :: coco.py 
Python :: scanning 2d array in python 
Python :: convert from epoch to utc python 
Python :: how to install python libraries 
Python :: python writing to csv file 
Python :: python loop through list 
Python :: find null value for a particular column in dataframe 
Python :: sorting pandas dataframe like excel 
Python :: sys get current pythonpath 
Python :: python code to plot pretty figures 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =