Base of all algorithms – the Algorithm class
All algorithms in OpenCV, or better yet, at least the ones that are not too short and simple, are created as subclasses of the cv::Algorithm
class. This class, as opposed to what you would normally expect, is not an abstract class, which means you can create instances of it, which simply do nothing. Even though this may be changed sometime in the future, it doesn't really affect the way we will access and use it. The way the cv::Algorithm
class is used in OpenCV, and also the recommended way in case you want to create your own algorithms, is that first a subclass of cv::Algorithm
that contains all required member functions for a specific purpose or goal gets created. Then, this newly created subclass can be again subclassed to create implementations of the same algorithm. To better understand this, let's first see the cv::Algorithm
class in detail. Here's (roughly) how it looks if you take a peek at the OpenCV source codes:
class Algorithm...