Skip to content

Instantly share code, notes, and snippets.

View MALLI7622's full-sized avatar
🎯
Focusing

pANDU MALLI7622

🎯
Focusing
View GitHub Profile
@bigsnarfdude
bigsnarfdude / gist:d811e31ee17495f82f10db12651ae82d
Last active May 19, 2022 12:18
[boundingBox] opencv example python - Contours – bounding box, minimum area rectangle, and minimum enclosing circle
import cv2
import numpy as np
# read and scale down image
# wget https://bigsnarf.files.wordpress.com/2017/05/hammer.png #black and white
# wget https://i1.wp.com/images.hgmsites.net/hug/2011-volvo-s60_100323431_h.jpg
img = cv2.pyrDown(cv2.imread('2011-volvo-s60_100323431_h.jpg', cv2.IMREAD_UNCHANGED))
# threshold image
ret, threshed_img = cv2.threshold(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY),