$$ax^2 + bxy + Cy^2 + dx + ey + f = 0$$

This is ellipse general equation.

Given coordinate values are $(0,1), (1,0), (2,1), (1.8,1.9), (0.5,1.9)$. I set the vector of the rightmost column of V matrix to $a, b, c, d, e, f$ by SVD decomposition with this coordinate value.

The Problem is ..

Given an ellipse's general type coefficients a, b, c, d, e, f, and implement opencv to draw an ellipse.

So Assume you know a,b,c,d,e,f value.

I want to draw ellipse with this information.

I guess I have to solve this parameter.

center – Center of the ellipse

axes – Half of the size of the ellipse main axes.

angle – Ellipse rotation angle in degrees.

But, i don't have idea to solve this problem.

How can i do??

  • $\begingroup$ If you only want to plot, use $y=-\frac{bx+e}{2c}\pm\sqrt{(\frac{bx+e}{2c})^2-\frac{ax^2+dx+f}{c}}$. $\endgroup$ – Jan-Magnus Økland May 4 '18 at 8:49

First you would want to find the center of the ellipse. An ellipse rotated at the origin will have the form $Ax'^2+Bx'y'+Cy'^2=1$. The center of the ellipse is say $(h, k)$. So we substitute $x'=x-h$ and $y'=y-k$. This gives us $$Ax^2+Bxy+Cy^2-(2Ah+kB)x-(2Ck+Bh)y+(Ah^2 + Bhk + Ck^2 − 1)=0$$ Now solving the system $$2ah+bk=-d\\bh+2ck=-e$$

If you rotate a standard ellipse by $\theta$ you will get $x'=x\cos\theta-y\sin\theta$ and $y'=x\sin\theta+y\cos\theta$ substitute this and we get $$\left[\frac{\cos^2\theta}{a^2}+\frac{\sin^2\theta}{b^2}\right]x^2+2\cos\theta\sin\theta\left[\frac1{a^2}-\frac1{b^2} \right]+\left[\frac{\cos^2\theta}{b^2}+\frac{\sin^2\theta}{a^2}\right]y^2=1$$ Comparing the coefficient will give you three equations and three unknowns which you can solve simultaneously. $$A-C=(\cos^2\theta-\sin^2\theta)\left(\frac1{a^2}-\frac1{b^2}\right)$$ Hence $$\tan2\theta=\frac B{A-C}$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.