Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

i don't think, you need the geneal solution above, we can simply exploit, that there are max. 2 times 180 in 360, then it's:

Mat mask = angle > 180.0f; subtract(angle, 180.0f, angle, mask);

or , in one line:

subtract(angle, 180.0f, angle, (angle>180.0f));

i don't think, you need the geneal general solution above, we can simply exploit, that there are max. 2 times 180 in 360, then it's:

Mat mask = angle > 180.0f;
subtract(angle, 180.0f, angle, mask);

mask);

or , in one line:

subtract(angle, 180.0f, angle, (angle>180.0f));

(angle>180.0f));

i don't think, you need the general solution above, we can simply exploit, that there are max. 2 times 180 in 360, then it's:

Mat mask = angle > 180.0f;
subtract(angle, 180.0f, angle, mask);

or , in one line:

subtract(angle, 180.0f, angle, (angle>180.0f));

you can even run wild with c++11 here:

angle.forEach([&](float &f, const int *p) {f = fmod(f,180.0f);});