I currently have an iplimage that has been modified using opencv. I am needing to draw an arc like that of the parabola of a quadratic equation, and I am unable to make one using the basic drawing functions built into opencv. I have been looking into opengl, but all I can find are bezier curves. What would be the best library to use to accomplish this?
Share
I wouldn’t recommend moving to OpenGL (based upon what you’ve provided in the post).
If you want to take a simple approach, you can solve the quadratic equation point-by-point (i.e. assume x is the independent variable and then solve for y). Once both x and y are known, you can draw the color at the specified point. I’ve provided a snippet below that illustrates a method for coloring a pixel in OpenCV. Take this code as it is: it worked for me, but it does not take into account any anti-aliasing, transparency, sub-pixel accuracy, etc.
Alternatively, you can use
OpenCV’s Bezier curve supportthird-party libraries for Bezier curve support in OpenCV. I’ve experimented with this one in the past. With a little computation, you can represent arbitrary conic sections using weighted Bezier curves. Take a look at the Rational Bezier Curves section near the bottom of the wikipedia page: Bezier Curve