How to fit an ellipse contour with 4 points?
<p>I have 4 coordinate points. Using these 4 points I want to fit an ellipse, but seems like the requirement for cv2.fitellipse() is a minimum of 5 points. Is there any way to get around this and draw a countour with just 4 points?</p>

<p>How does fitellipse draw a contour when cv2.CHAIN_APPROX_SIMPLE is used, which gives only 4 coordinates point. </p>

<p>Four points aren't enough to fit an ellipse without ambiguity (don't forget that a general ellipse can have arbitrary rotation). You need at least five to get an exact solution or more to fit in a least square manner. For a more detailed explanation I found <a href="https://sarcasticresonance.wordpress.com/2012/05/14/how-many-points-does-it-take-to-define/" rel="nofollow">this</a>.</p>

<p>You can draw the countour itself (without fitting anything) with <code>drawContours</code> (or fit e.g. a circle).</p>

<p>So to answer your second question (assuming that I understand it right): It doesn't if there are less than 5 points available, but <code>FindContours</code> in combination with <code>CHAIN_APPROX_SIMPLE</code> returns eventually more depending on the particular detected contour. </p>

<p>See <a href="http://docs.opencv.org/2.4/doc/tutorials/imgproc/shapedescriptors/bounding_rotated_ellipses/bounding_rotated_ellipses.html" rel="nofollow">here</a>. In this C++ example ellipses are only fitted if at least 5 points are available.</p>

python opencv image-processing