Reputation: 194
I want to understand if I should prefer to use the matrix operations defined for the cv::Mat class of OpenCV or if their computational time is the same of iterating with for loop on array of doubles.
Upvotes: 1
Views: 885
Reputation: 6666
OpenCV cv::Mat classes use pointers in order to make them as efficient as possible. That being said, if you want to do a very specific manipulation you may find it quicker to implement yourself.
Below is the simple cv::Mat transpose code from the OpenCV Source Code:
void MatOp::transpose(const MatExpr& expr, MatExpr& res) const
{
Mat m;
expr.op->assign(expr, m);
MatOp_T::makeExpr(res, m, 1);
}
Upvotes: 1