We will port the ImageDetectionFilter
class to C++. However, for the sake of limiting this project's scope, we will leave CameraProjectionAdapter
and ARCubeRenderer
as pure Java classes.
Once again, let's start with a header file, ImageDetectionFilter.hpp
. This header uses types from OpenCV's core
and features2d
modules, plus the Standard Template Library's std::vector
class. (The latter class is analogous to Java's ArrayList
.) Accordingly, we can begin the header with the following code:
#ifndef IMAGE_DETECTION_FILTER #define IMAGE_DETECTION_FILTER #include <vector> #include <opencv2/core/core.hpp> #include <opencv2/features2d/features2d.hpp> namespace secondsight {
The C++ version of ImageDetectionFilter
has the same methods as the Java version. The arguments differ slightly, as we will still require the Java side to provide the reference image (for the constructor) and the projection matrix (for the apply
method). Let's declare the C++ methods...