Repository: opencv
Issue: OpenCL in WinRT not available
Labels: feature,priority: low,platform: winrt/uwp

I have a windows UWP application running on DragonBoard 410c which has OpenCL, OpenGL, and DirectX capabilities.
I noted that the GPUs were not being used,
With the following code:
cv::ocl::setUseOpenCL(true);
cv::ocl::useOpenCL();
if (!cv::ocl::haveOpenCL())
{
  OutputDebugStringA("OpenCL is not available...");
//return;
}

It returns "OpenCL is not available" which I can also see from the lack in performance.
### Please state the information for your system
- OpenCV version: 3.0
- Host OS:  Windows 10
- _(if needed, only cross-platform builds)_ Target OS: DragonBoard 410C running Win 10 iot Core
- _(if needed)_ Compiler & CMake: CMake 3.5 + Visual Studio 2015
### In which part of the OpenCV library you got the issue?

core
### Expected behaviour

Use opencl acceleration when using UMat in code
### Actual behaviour

Reverting to using standard Mat without opencl acceleration
### Additional description

The opencv 3.0/ vs2015/WS/10.0/ARM/OpenCV.sln
Was utilised to generate files an bring into VS2015 project as provided.
### Code example to reproduce the issue / Steps to reproduce the issue

Please try to give a full example which will compile as is.

```
// main.cpp

// Copyright (c) 2013, Microsoft Open Technologies, Inc. 
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, 
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, 
//   this list of conditions and the following disclaimer.
// - Redistributions in binary form must reproduce the above copyright notice, 
//   this list of conditions and the following disclaimer in the documentation 
//   and/or other materials provided with the distribution.
// - Neither the name of Microsoft Open Technologies, Inc. nor the names 
//   of its contributors may be used to endorse or promote products derived 
//   from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "pch.h"

#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/features2d.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/videoio/cap_winrt.hpp>
#include <opencv2/objdetect/objdetect.hpp>
//#include <opencv2/objdetect/objdetect_c.h>


//#include "../../objdetect/include/opencv2/objdetect/detection_based_tracker.hpp"


#include "../src/cap_winrt_bridge.hpp"

#include <opencv2/hal.hpp>
//#include <opencv2/hal/intrin_neon.hpp>
#include <opencv2/core/directx.hpp>
#include <opencv2/core/ocl.hpp>
#include <arm_neon.h>
//#include <opencv2/hal/intrin_neon.hpp>

//#include <opencv2/objdetect/detection_based_tracker.hpp>
//#include "winapp.hpp"


//#define COLOR
//#define CANNY
#define FACESP
#define HAVE_OPENCL
#define HAVE_NEON
#define HAVE_OPENCL
#define OPENCV_OPENCL_DEVICE = ":GPU:0"



using namespace cv;
using namespace std;


namespace highgui_xaml
{
    // forward declaration
    void cvFilterColor(Mat &frame);
    void cvFilterCanny(Mat &frame);
    void cvDetectFaces(Mat &frame);
    //initializing frame counter used by face detection logic
    long frameCounter;

    UMat faces;
    UMat facesl;
    std::vector<cv::Rect> facesColl;
    std::vector<cv::Rect> bodyColl;
    std::vector<cv::Rect> pedestrianColl;

    UMat Uframe;
    Mat FrameToShow;
    std::vector<cv::Rect> face;

    CascadeClassifier face_cascade;
    String face_cascade_name = "Assets/haarcascade_frontalface_alt.xml";

    CascadeClassifier body_cascade;
    String body_cascade_name = "Assets/haarcascade_upperbody.xml";
    //String body_cascade_name = "Assets/haarcascade_fullbody.xml";

    CascadeClassifier pedestrian_cascade;
    String pedestrian_cascade_name = "Assets/hogcascade_pedestrians.xml";

    const double scale = 1.05;
    const int nlevels = 13;
    const int gr_threshold = 8;

    const double hit_threshold = 1.4;
    const bool gamma_corr = false;

    //const Size win_size(240, 320);
    //const Size win_size(48, 96);
    //aqconst Size win_stride(8, 8);

    static vector<float> detector = HOGDescriptor::getDefaultPeopleDetector();
    //static vector<float> detector = HOGDescriptor::getDaimlerPeopleDetector();

    HOGDescriptor Hog;//(win_size, Size(16, 16), Size(8, 8), Size(8, 8), 9, 1, -1, HOGDescriptor::L2Hys, 0.2, gamma_corr, HOGDescriptor::DEFAULT_NLEVELS);



    void cvMain()
    {
        cv::CPU_NEON;
        cv::setUseOptimized(true);
        cv::ocl::setUseOpenCL(true);
        cv::ocl::useOpenCL();


        if (!cv::ocl::haveOpenCL())
        {
            OutputDebugStringA("OpenCL is not available...");
            //return;
        }

        //initializing frame counter used by face detection logic
        frameCounter = 0;

        // loading classifier for face detection
        face_cascade.load(face_cascade_name);

        // loading classifier for upper body detection logic
        body_cascade.load(body_cascade_name);


        // Setup Hog detector
        //HOGDescriptor Hog(win_size, Size(16, 16), Size(8, 8), Size(8, 8), 9, 1, -1, HOGDescriptor::L2Hys, 0.2, gamma_corr, HOGDescriptor::DEFAULT_NLEVELS);
        Hog.setSVMDetector(detector);
        Hog.nlevels = nlevels;


        VideoCapture cam(0);

        cam.set(cv::CAP_PROP_FRAME_WIDTH, 320);
        cam.set(cv::CAP_PROP_FRAME_HEIGHT, 240);
        cam.set(cv::CAP_DSHOW, true);
        cam.set(cv::CAP_MODE_GRAY, true);
        cam.set(cv::CAP_PROP_CONVERT_RGB, false);
        cam.open(0);    

        Mat frame(Size(240, 320), CV_8UC3);

        // process frames
        while (1)
        {
            // get a new frame from camera - this is non-blocking per spec
            cam >> frame;
            frameCounter++;

            // don't reprocess the same frame again
            // nb if commented then flashing may occur
            if (!cam.grab()) continue;

            // image processing calculations here
            // nb Mat frame is in RGB24 format (8UC3)

            // select test 1 or 2

            // select processing type


#if defined COLOR
            cvFilterColor(frame);
#elif defined CANNY
            cvFilterCanny(frame);
#elif defined FACESP
    // processing every other frame to reduce the load
            if (frameCounter % 2 == 0)
            {
                cvDetectFaces(frame);
                frameCounter = 0;
            }
#endif
            winrt_imshow();
        }
    }


    // image processing example #1
    // write color bar at row 100 for 200 rows
    void cvFilterColor(Mat &frame)
    {

        auto ar = frame.ptr(100);
        int bytesPerPixel = 3;
        int adjust = (int)(((float)30 / 100.0f) * 255.0);
        for (int i = 0; i < 640 * 100 * bytesPerPixel;)
        {
            ar[i++] = adjust;           // R
            i++;                        // G
            ar[i++] = 255 - adjust;     // B
        }

    }

    // image processing example #2
    // apply edge detection aka 'canny' filter
    void cvFilterCanny(Mat &frame)
    {

        Mat edges;
        cvtColor(frame, edges, COLOR_RGB2GRAY);
        GaussianBlur(edges, edges, Size(7, 7), 1.5, 1.5);
        Canny(edges, edges, 0, 30, 3);
        cvtColor(edges, frame, COLOR_GRAY2RGB);


    }

    // image processing example #3
    // detect human faces
    void cvDetectFaces(Mat &frame)
    {


        frame.copyTo(Uframe);

        cvtColor(Uframe, faces, COLOR_RGB2GRAY);

        equalizeHist(faces, faces);

        /*

        body_cascade.detectMultiScale(faces, bodyColl, 1.1, 2, 0 | CV_HAAR_SCALE_IMAGE, cv::Size(20, 20));
        if (bodyColl.size() > 0)
        {
            for (unsigned int i = 0; i < bodyColl.size(); i++)
            {
                auto face = bodyColl[i];
                //Mat temp = frame.getMat(ACCESS_READ | ACCESS_WRITE);
                cv::rectangle(frame, face, cv::Scalar(0, 255, 255), 3);
                //cv::rectangle(temp, face, cv::Scalar(0, 255, 255), 3);
                //temp.getUMat(ACCESS_READ | ACCESS_WRITE).copyTo(frame);
            }

            //cv::winrt_imshow();
        }

        */
        //Hog.detectMultiScale(faces, bodyColl, hit_threshold, win_stride, Size(0, 0), scale, gr_threshold);
        Hog.detectMultiScale(faces, bodyColl,0.0, cv::Size(8,8), cv::Size(0, 0), 1.2,0.0,true);


        if (bodyColl.size() > 0)
        {
            for (unsigned int i = 0; i < bodyColl.size(); i++)
            {
                //face.assign(bodyColl[i]);
                //Mat temp = frame.getMat(ACCESS_READ | ACCESS_WRITE);
                cv::rectangle(frame, bodyColl[i], cv::Scalar(0, 255, 255), 3);
                //cv::rectangle(Uframe, face, cv::Scalar(0, 255, 255), 3);
                //temp.getUMat(ACCESS_READ | ACCESS_WRITE).copyTo(frame);
            }
            //cv::winrt_imshow();

        }
        /*
        else
        {
            face_cascade.detectMultiScale(faces, facesColl, 1.2, 2, 0 | CV_HAAR_SCALE_IMAGE, cv::Size(20, 20)); //CV_HAAR_SCALE_IMAGE CASCADE_SCALE_IMAGE

            if (facesColl.size() > 0)
            {
                for (unsigned int i = 0; i < facesColl.size(); i++)
                {
                    auto face = facesColl[i];
                    cv::rectangle(frame, face, cv::Scalar(0, 255, 255), 3);
                }
            }
        }
        */
        /*
        body_cascade.detectMultiScale(faces, bodyColl, 1.2, 1,0|CV_HAAR_SCALE_IMAGE,cv::Size(20,20));
        if (bodyColl.size() > 0)
        {
            for (unsigned int i = 0; i < bodyColl.size(); i++)
            {
                auto face = bodyColl[i];
                //Mat temp = frame.getMat(ACCESS_READ | ACCESS_WRITE);
                cv::rectangle(frame, face, cv::Scalar(0, 255, 255), 3);
                //cv::rectangle(temp, face, cv::Scalar(0, 255, 255), 3);
                //temp.getUMat(ACCESS_READ | ACCESS_WRITE).copyTo(frame);
            }
        }
        */

    }
}
```