I have to perform the following per-element product:
out = dist * v1 * v2 / res;
where:
-
dist
is a scalar (double) -
v1
,v2
,v3
arecv::Vec2d
(vector of 2double
)
My very easy peasy code with opencv
:
return (dist * v1).mul(v2).div(v3);
The error I got (compiling with cl.exe
under VC17):
E0312 no suitable user-defined conversion from "cv::Matx<double, 2, 1>" to "cv::Vec2d" exists
Breaking down the operations, the problem is with .div
, while .mul
works fine.
Now, looking at the doc, I can note:
-
cv::Vec<_Tp,cn>
is inherited fromcv::Matx<_Tp,cn,1>
, thuscv::Vec2d
should be the same ascv::Matx<double,cn,1>
. Am I missing something? -
cv::Vec<_Tp,cn>
is cited into the doc, but I’ve not found either the declaration ofcv::Vec<_Tp,cn>::div
nor a mention to it or to the per-element division operation in general. However the method does exists.
Any idea where I’m wrong and how to (easily) fix?