Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV with UWP

We have created a wrapper for the OpenCV C++ in C++/CX in order to use it in our interface. We use our wrapper in many other projects and everything was just fine.

Now we are trying to use it in a new project in UWP (C#). The UWP project should also capture frames from the camera.

For some reason the OpenCV dose not open the cameras when our library attached to UWP projects. We've debugged the OpenCV itself, and we saw that the OpenCV gets HRESULT of E_ACCESSDENIED when it tries to open the camera, even all the permissions of UWP allowed (including WebCam).

This is the code that opens the default camera:

VideoCapture cap(0); // open the default camera
if(!cap.isOpened())
    return -1;

And we always failed to open the camera and the reason is E_ACCESSDENIED error.

Another restriction is that we have to use our native library, and we can't work with other kind of OpenCV wrappers for UWP (because this library is reused in may other projects).

Any idea how to capture a frame in UWP with the native OpenCV implementation?

OpenCV with UWP

We have created a wrapper for the OpenCV C++ in C++/CX in order to use it in our interface. We use our wrapper in many other projects and everything was just fine.

Now we are trying to use it in a new project in UWP (C#). The UWP project should also capture frames from the camera.

For some reason the OpenCV dose not open the cameras when our library attached to UWP projects. We've debugged the OpenCV itself, and we saw that the OpenCV gets HRESULT of E_ACCESSDENIED when it tries to open the camera, even all the permissions of UWP allowed (including WebCam).

This is the code that opens the default camera:

VideoCapture cap(0); // open the default camera
if(!cap.isOpened())
    return -1;

And we always failed to open the camera and the reason is E_ACCESSDENIED error.

Another restriction is that we have to use our native library, and we can't work with other kind of OpenCV wrappers for UWP (because this library is reused in may other projects).

Any idea how to capture a frame in UWP with the native OpenCV implementation?