Implimentation "cv::Mat::forEach"
authorKazuki Matsuda <matsuda.kazuki@facebook.com>
Sun, 5 Jan 2014 16:42:45 +0000 (01:42 +0900)
committerKazuki Matsuda <matsuda.kazuki@facebook.com>
Sun, 18 May 2014 02:01:45 +0000 (11:01 +0900)
commitfa292c3d8d8c57836e9d7d279a70ff126320259e
tree5a0fda1acd01165241d9c7198d24082ebce00f1d
parentcafcfc4d0fd0391d627967027080a85a6a5987a1
Implimentation "cv::Mat::forEach"

I propose forEach method for cv::Mat and cv::Mat_.
This is solution for the overhead of MatIterator_<_Tp>.

I runs a test that micro opecode runs all over the pixel of cv::Mat_<cv::Point3_<uint8_t>>.
And this implementation 40% faster than the simple pointer, 80% faster than iterator.
With OpenMP, 70% faster than simple pointer, 95% faster than iterator (Core i7 920).

Above all, code is more readable.

My test code is here.
    https://gist.github.com/kazuki-ma/8285876

Thanks.
modules/core/doc/basic_structures.rst
modules/core/include/opencv2/core/mat.hpp
modules/core/include/opencv2/core/mat.inl.hpp
modules/core/include/opencv2/core/utility.hpp
modules/core/test/test_mat.cpp