Correctly enable OpenCL mode in tapi's hog example.

For current OpenCV-CL architecture, if the data buffer
allocated in UMat are cpu buffer(not ocl buffer) under
cpu mode, and then pass this UMat to an OpenCL kernel
as an argument, the OpenCL path will fail and fallback
to cpu mode. Take HOGDescriptor::oclSvmDetector as an example:
    ocl::setUseOpenCL(false);
    //data allocated in hog.oclSvmDetector will be cpu buffer
    hog.setSVMDetector(HOGDescriptor::getDaimlerPeopleDetector());
    ocl::setUseOpenCL(true);
    //We enabled OpenCL, but hog.oclSvmDetector are cpu buffer,
    //so it will fail in the function ocl_classify_hists
    //when reach to this line
    //idx = k.set(idx, ocl::KernelArg::PtrReadOnly(detector));
    hog.detectMultiScale(img, found, hit_threshold, win_stride,
            Size(0, 0), scale, gr_threshold);

Similar problems heppen on img_aux and img. So we should re-define
or re-set these UMat when do mode switch (CPU -> OpenCL) in order
to make their data be allocated by ocl and then OpenCL path will
succeed.

Signed-off-by: Chuanbo Weng <chuanbo.weng@intel.com>
Update hog.cpp

Update according to vbystricky's comments
added performance validation check
Small optimization for buildMaps kernels in case rowsPerWI > 1
Added tests for Image2D
Optimize OpenCL version of StereoBM function
Fix problems on NVidia devices.
ocl: restore clFinish() in unmap() for AMD devices

This reverts commit 7d91b8efcd053304e5b0fb5afff06e151b2d4096.
Added extra checks to ocl::Image2D
Merge pull request #3368 from alalek:amd_clfinish
Merge pull request #3284 from vbystricky:oclopt_stereoBM
Move _dst.create() to the begining of scaleAdd function
Merge pull request #3342 from alalek:perf_stability_check
Merge pull request #3367 from akarsakov:ocl_image2d
Merge pull request #3369 from vbystricky:fix_scaleAdd
Overload PlaneWarper::buildMaps method from base class
Added checking that z is non zero to buildWarpPlaneMaps kernel
Merge pull request #3359 from akarsakov:ocl_buildMaps
Merge pull request #3353 from Chuanbo-Weng:master