is there any builtin Modulo function on Matices ?
I've a Mat object containing these orientation values (0 to 360), i want by using modulo operation to represent them between (0 to 180) range
Mat a, b;
...
b = mod(a,180); // x - floor(x/y) * y
didn't find it, i tried this instead
void Modulo(Mat &angle, int val){
for(int i = 0; i < angle.rows; i++){
for(int j = 0; j < angle.cols; j++){
// x - floor(x/y) * y
float result = angle.at<float>(i,j) - cvFloor(angle.at<float>(i,j)/val) * val;
angle.at<float>(i,j) = result;
}
}
}
do you really need the "general" solution ? or would
if v > 180 then v-= 180
do in your case?general case would be better