Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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.

share|improve this question
1  
Have you tried measuring it? –  KeillЯandor 2 hours ago

1 Answer 1

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);
}
share|improve this answer
    
This seems to be CUDA code, what is its relation to the question? –  anderas 1 hour ago
    
changed the code, the point is OpenCV is optimised unless you have a very specific example –  GPPK 1 hour ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.