Subversion Repositories seema-scanner

Rev

Rev 50 | Rev 81 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 50 Rev 74
Line 120... Line 120...
120
            }
120
            }
121
        }
121
        }
122
    }
122
    }
123
}
123
}
124
 
124
 
-
 
125
// Returns the result of mod(mat(x,y), moduli) for each matrix element
-
 
126
cv::Mat modulo(const cv::Mat &mat, float n){
-
 
127
 
-
 
128
    cv::Mat ret(mat.rows, mat.cols, mat.type());
-
 
129
 
-
 
130
    for(int row=0; row<ret.rows; row++){
-
 
131
        for(int col=0; col<ret.cols; col++){
-
 
132
            float val = mat.at<float>(row, col);
-
 
133
            // note: std::fmod calculates the remainder, not arithmetic modulo
-
 
134
            ret.at<float>(row, col) = val - n * std::floor(val / n);
-
 
135
        }
-
 
136
    }
-
 
137
 
-
 
138
    return ret;
-
 
139
}
-
 
140
 
125
// Convert a 3xN matrix to a vector of Point3fs.
141
// Convert a 3xN matrix to a vector of Point3fs.
126
void matToPoints3f(const cv::Mat &mat, std::vector<cv::Point3f> &points){
142
void matToPoints3f(const cv::Mat &mat, std::vector<cv::Point3f> &points){
127
 
143
 
128
    unsigned int nPoints = mat.cols;
144
    unsigned int nPoints = mat.cols;
129
    points.resize(nPoints);
145
    points.resize(nPoints);