Fix for (Bug #2789)

Add MatlabFormatter for matlab style output.
See http://code.opencv.org/issues/2789
Merge branch 'master' into matlab_formatter
cv::findContours: Check if type of output data structure is right to store contours (vector<vector<Point>>).
Fixed scanning bug identified in comments in pull request #1119.
NFA calculations now generate better line segments.
Fixed MATLAB bridge

MATLAB bridge.hpp was missing definition for Ptr<DenseOpticalFlow>
Merge branch 'master' of https://github.com/Itseez/opencv
DownhillSolverImpl::innerDownhillSimplex something looks broken here:
Mat_<double> coord_sum(1,ndim,0.0),buf(1,ndim,0.0),y(1,ndim,0.0);
nfunk = 0;
for(i=0;i<ndim+1;++i)
{
y(i) = f->calc(p[i]);
}
y has only ndim elements, while the loop goes over ndim+1
Unroll pyrUp kernel
Removed useless multiplication by 4
Updating missed defines in documentation

Updating missed defines in documentation. The new defines (in imgproc.hpp) state they have a prefix of COLOR instead of CV.
Issue #3709 - PyBindings for LSD

Corrected crashing in Python bindings while using LSD_REFINE_NONE flags
Corrected not drawing lines in drawSegments and compareSegments in Python bindings
Updated and added haarcascade_mcs*.xml files
Update global_motion.cpp

An extremely rare case where, for numeric reasons bestM finds more inliers than ninliersMax. 
This RARE case causes memory corruption and a nasty seg fault.
some optimizaions of cv::pow
optimized cv::calcHist
eliminated convertTo
optimized histogram merging
cv::equalizeHist
Changing #include to generic video.hpp

Per https://github.com/Itseez/opencv/pull/2783#discussion_r13573590
Added support for 3-channels