Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Does OpenCV implement any one of the root-finding algorithms?

Does OpenCV implement any one of the root-finding algorithms, as listed on Root-finding algorithm (Wikipedia article)?

Something similar to Brent's method would be highly desirable, although Secant method would still be useful as a starting point.

In particular,

  • I would like to use it on a single variable input, single variable output "blackbox".
  • The "blackbox" is not an analytic function, so there is no derivatives.
    • In fact, it is not even a mathematical function in the usual sense - please read on.

The reason I am asking is because I would like to implement a JPEG compression file size goal-seeker, which I have described in my answer to this Stackoverflow question: Automatically choose JPEG compression level in OpenCV.

As part of the implementation, the image will be compressed multiple times with different JPEG compression levels, until it finds one with output file size approximately near the goal.

For efficiency, the number of "evaluations" (which involves actual JPEG compression of the image) need to be as small as possible, and hence a good non-analytic iterative root-finding algorithm is necessary.