Prepare Downhill Simplex for pull request

This is an implementation of so-called downhill simplex method
(https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method)

Please, let me know if you have any comments, whoever you'd be.
Removed trailing spaces

This caused warnings.
Removed trailing spaces

Continuation of work done in previous commit.
Fixed .rst indentation

This caused warnings.
Minor fixes

In response to the pull request comments by Vadim Pisarevsky. In
particular, the following was done:
    *)cv::reduce use instead of custom code for calculating
per-coordinate sum
    *) naming style of private methods is made consisted with overall --
mixed-case style
    *) irrelevant create()'s were removed -- I did not know that copyTo()
method itself calls create
Update on LSD no to use any Mat* (IOArrays instead).
Updated to new license.
Added LineSegmentDetector documentation and an output image.
Removed IOArray constness.
Update on the compare lines method.
Replaced Ptr with my new implementation.
Boring changes - core.

This and several following commits contain the "boring" changes required
to support the new Ptr. These are changes like:

* new T -> makePtr<T> or .reset(new T) or Ptr<T>(new T)
  (depending on the situation)
* p.empty() -> !p
* delete_obj -> DefaultDeleter::operator()

and similar changes that are numerous, but primitive.
Boring changes - imgproc.
Boring changes - highgui.
Boring changes - bioinspired.
Boring changes - calib3d.
Boring changes - features2d.
Boring changes - ml.
Boring changes - nonfree.
Boring changes - objdetect.
Boring changes - photo.