I am using CxxWrap to create a simple wrapper for OpenCV.
cv::decomposeHomographyMat() takes std::vector<cv::Mat>
as an argument, how can I wrap this?
I tried jlcxx::ArrayRef<jlcxx::ArrayRef<double, 2>, 1>
but I get static_assert as shown below.
int decomposeHomographyMat(
jlcxx::ArrayRef<double, 2> H,
jlcxx::ArrayRef<double, 2> K,
jlcxx::ArrayRef<jlcxx::ArrayRef<double, 2>, 1> rotations,
jlcxx::ArrayRef<jlcxx::ArrayRef<double, 2>, 1> translations,
jlcxx::ArrayRef<jlcxx::ArrayRef<double, 2>, 1> normals )
{
cv::Mat HMat(3, 3, CV_64F, H.data());
cv::Mat KMat(3, 3, CV_64F, K.data());
std::vector<cv::Mat> rMat,tMat,nMat;
auto n = cv::decomposeHomographyMat(HMat, KMat, rMat, tMat, nMat);
double* data;
for(int i = 0 ; i < n ; ++i)
{
data = new double[3*3];
memcpy( data, (double*)(rMat[i].data), 3*3*sizeof(double));
rotations.push_back(jlcxx::ArrayRef<double, 2>(true, data, 3, 3));
data = new double[3];
memcpy( data, (double*)(tMat[i].data), 3*sizeof(double));
translations.push_back(jlcxx::ArrayRef<double, 2>(true, data, 3, 1));
data = new double[3];
memcpy( data, (double*)(nMat[i].data), 3*sizeof(double));
normals.push_back(jlcxx::ArrayRef<double, 2>(true, data, 3, 1));
}
return n;
}
[build] /Users/kemu/.julia/artifacts/9fbaafa4a3ec669b8c626f20771d9056d16f4f5a/include/jlcxx/array.hpp:223:5: error: static assertion failed due to requirement 'std::is_same<jl_array_t *, jlcxx::ArrayRef<double, 2>>::value': ArrayRef::push_back is only for arrays of fundamental types
[build] static_assert(std::is_same<julia_t,ValueT>::value, "ArrayRef::push_back is only for arrays of fundamental types");
[build] ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The OpenCV.jl and Python version of OpenCV using PyCall.jl and PythonCall.jl have their own problems from my point of view, so let these methods be out of scope for this time.