Conversation
84cf64b to
cd8ef0c
Compare
basic operations, functions(exp,log,norm,inv), to/from mat, sclerp.
|
Happy new year! @savuor |
change algorithm of norm, inv, getTranslation, createFromPitch, normalize; change type translation to Vec3; comment improve;
| std::vector<Vec<_Tp, 3>> &out_normals, | ||
| const std::vector<DualQuat<_Tp>> &dualquat, | ||
| const std::vector<std::vector<_Tp>> &weights, | ||
| const std::vector<std::vector<int>> &joints_id, |
There was a problem hiding this comment.
It's better to use InputArray and OutputArray for vertices, normals, weights and ids instead of vectors. Internally the type and dimensionality should be checked.
| std::vector<Vec<T, 3>> &out_vert, std::vector<Vec<T, 3>> &out_normals, | ||
| const std::vector<DualQuat<T>> &_dualquat, const std::vector<std::vector<T>> &weights, | ||
| const std::vector<std::vector<int>> &joint_id, QuatAssumeType assumeUnit) | ||
| { |
There was a problem hiding this comment.
I think this function should be moved to some .cpp file. Here's motivation why:
Typical use case for this function is to transform point clouds and vertices which are counted in thousands. This may involve massive parallel processing using parallel_for_, SIMD or OpenCL.
Having such a code in a header makes no sense; this would slow down the compilation. Having this in .inl.hpp has even less sense since this is not a good function to be inlined.
There was a problem hiding this comment.
OK, I've temporarily removed this function, but have no idea where to put it
There was a problem hiding this comment.
You can create a separate .cpp file, like dqs.cpp or something
There was a problem hiding this comment.
Is it possible to separate declarations and definitions of template functions? I did some consulting and I saw that most of the template class functions that can be run were written together. Is there a way to separate them?
| } | ||
| for (size_t i = 0; i < in_vert.size(); ++i) | ||
| { | ||
| DualQuat<T> dq_blend; |
There was a problem hiding this comment.
Here gdqblend can be reused with QUAT_ASSUME_UNIT argument
add func(obj) operations;
add assumeUnit in getRotation; remove dqs; change std::vector to InputArray
There was a problem hiding this comment.
Most of the code looks good to me.
The only thing to change is to use InputArray instead of vector<DualQuat<T>> or Vec<DualQuat<T>, n>. This makes sense not only for gdqblend but for dqs as well. A type should be checked along with size, it's OK to allow floats and doubles only in such functions.
Doing this would resolve the problem with definition of template function in .cpp file since there'll be no templates.
P.S. Sorry for not answering for such a long time.
| * @note the type of weights' element should be the same as the date type of dual quaternion inside the dualquat. | ||
| */ | ||
| template <int cn> | ||
| static DualQuat<_Tp> gdqblend(const Vec<DualQuat<_Tp>, cn> &dualquat, InputArray weights, |
There was a problem hiding this comment.
I think dualQuat should be an InputArray too, as well as weights, with type/size checks
There was a problem hiding this comment.
OK. I‘ll complete it next week
There was a problem hiding this comment.
I found it will raise an error when Vec<DualQuat<double>, n> converts into InputArray, and Matx will also happen like this
error: ‘type’ is not a member of ‘cv::DataType<cv::DualQuat<double> >’
There was a problem hiding this comment.
Maybe to fix this by introducing a separate alias for this function with Vec<DualQuat<float/double>> as an argument type? Like, there'll be a function gdqblend(InputArray dualQuat,...) that requires dualQuat to have 8 rows/channels of float/double. And 2 functions gdqblend(const Vec<DualQuat<float/double>, 8> &dualquat,... that call the InputArray version.
There was a problem hiding this comment.
Do you mean to call function gdqblend(const Vec<DualQuat<float/double>, n> ... ) in function gdqblend(InputArray dualQuat,...) ?
There was a problem hiding this comment.
The opposite: the basic function is the one with InputArray, it's called by the function with const Vec<DualQuat<float/double>, n>.
|
@chargerKong @alalek Looks like #19538 fixes the problems in this build. Can we merge the one to another? |
|
There is no automatic merge process between patches. |
Dual quaternion * create dual quaternion; basic operations, functions(exp,log,norm,inv), to/from mat, sclerp. * add dqb, dqs, gdqb, to/from affine3; change algorithm of norm, inv, getTranslation, createFromPitch, normalize; change type translation to Vec3; comment improve; * try fix warning: unreferenced local function * change exp calculation; add func(obj) operations; * Change the algorithm of log function; add assumeUnit in getRotation; remove dqs; change std::vector to InputArray * fix warning: doxygen and Vec<double, 0> * fix warning: doxygen and Vec<double, 0> * add inputarray param for gdqb * change int to size_t * win cl warning fix * replace size_t by int at using Mat.at() function * replace double by float * interpolation fix * replace (i, 0) to (i) * core(quat): exclude ABI, test_dualquaternion=>test_quaternion.cpp Co-authored-by: arsaratovtsev <arsaratovtsev@intel.com> Co-authored-by: Alexander Alekhin <alexander.a.alekhin@gmail.com>
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.