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.
Build both Python 2 and Python 3 bindings

If both Python 2 and Python 3 are found, then build bindings for both of
them during the build process.  Currently, one version of Python is
detected automatically, and building for the other requires changes the
CMake config.

The largest chunk of this change generalizes OpenCVDetectPython.cmake to
find both a Python 2 and Python 3 version of Python.  Secondly, the
opencv_python module is split into two modules, opencv_python2 and
opencv_python3.  Both are built from the same source. but for different
versions of Python.
Merge branch 'master' into python2and3
Reference PYTHON_NUMPY_INCLUDE_DIRS not PYTHON_NUMPY_INCLUDE_PATH

PYTHON_NUMPY_INCLUDE_PATH was a typo, it should have been
PYTHON_NUMPY_INCLUDE_DIRS.
Merge branch 'master' into python2and3
Fix a few more PYTHON_NUMPY_INCLUDE_PATH

The previous commit fixing references to PYTHON_NUMPY_INCLUDE_PATH
missed a few unset()s.
Place Python library out in dedicated folder

Place the built Python module library in a dedicated folder inside of
lib/.  This ensures that even if the Python 2 and Python 3 module names
conflict, they will not overwrite one another.
fix misinterpretation of empty window name

The documentation states, that a NULL or an empty window name can be used
to refer to the control panel. But the string parameters of the C++ frontend
methods cannot be NULL and converting an empty string to a const char* by
c_str() doesn't produce a NULL pointer, but an empty string. Unfortunately,
the const char* pointer is just passed on to the standard C functions in
the QT backend, which doesn't check for the empty string case.

There are two places where the empty string check could have been introduced:
inside the frontend or inside the backend. As long as the documentation only
mentions this as a special case for the QT backend, the best place seems to
be there.
Add opencv_matlab to Python ignored modules

Requested by @vpisarev in #3047.
Build Python 3 bindings in subdirectory

Build the Python 3 cv2 module in lib/python3/, to avoid potential naming
conflicts with the Python 2 bindings.

The Python 2 bindings are placed directly in lib/, where they are
required for the Buildbot to successfully execute the Python tests.
Support Python 2 and 3 in test script

Add Python 3 support to the Python test.py script.

The print function is used in place of the print statement.

The urlopen function has been moved to urllib.request in Python 3, so
attempt to import it from either location.

TestCase.assert_() has been deprecated in place of
TestCase.assertTrue().

The tests all pass in both Python 2 and 3.
Merge branch 'master' into python2and3
Merge pull request #3054 from zillatrooper:master
Merge pull request #3047 from prattmic:python2and3
Revert optimization for warpAffine INTER_NEAREST mode
Fixed rounding in remap INTER_LINEAR mode
Fixed calculate_histogram kernel
Fixed extrapolation in pyrDown
Fixed issue: Mat::copyTo(UMat) if device copy is obsolete. Added test.
fixed tests for ocl_filter2d, ocl_matchTemplate, ocl_histogram.cpp