on-internet
← Community

Is there a way to draw inscribed ellipse in a almost rectangular contour?

Stack Overflow ·

I am wondering if there is a way to inscribe an ellipse in almost rectangular contour? I am using openCV findcontours() method in my image and my aim is to fit biggest possible ellipses inside every object in the following image: Code I am using: import cv2 import numpy as np def find_contours(preprocessed, min_perimeter): contours, hierarchy = cv2.findContours(preprocessed,cv2.RETR_TREE,cv2.CHAIN_APPROX_NONE) #find contours contours_new = [] #new empty list of contours for cnts in contours: #looping trough contours perimeter = cv2.arcLength(cnts,True) #arc length if perimeter > min_perimeter:

Comments

Sign in or sign up to comment and upvote.

No comments yet.