I am writing a C++ shared library (.so
) whose main function will be to process features from images processed by OpenCV. However, the algorithm in this shared library is not specifically for vision -- it could receive measurements from RADAR, LiDAR, etc.
As I am architecting the library, I am trying to keep the OpenCV dependency out of it and instead use the more general Eigen3 matrix library.
My question is about the interface between application code and my library. I have a public method that will accept a list of position and velocity measurements of each feature from the application:
void add_measurements(std::vector< std::tuple<double, double> > pos,
std::vector< std::tuple<double, double> > vel);
Is it best to leave the data structures on the API interface as primitive as possible, like above? Or should I force the application code to provide a std::vector<Eigen::Vector2d>
for measurements?
Further, should I allow std::vector<cv::Point2f>
from the application code and then just convert to Eigen3 or whatever internally? This one seems the least useful since the library will still depend on OpenCV.