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.
Boring changes - softcascade.
Boring changes - stitching.
Boring changes - superres.
Boring changes - video.
Boring changes - videostab.
Boring changes - gpu.
Boring changes - gpuarithm.
Boring changes - gpubgsegm.
Boring changes - gpucodec.