1

We have created a wrapper for the OpenCV C++ in C++ 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?

Cheers and hth. - Alf
  • 142,714
  • 15
  • 209
  • 331
nrofis
  • 8,975
  • 14
  • 58
  • 113
  • I suspect you need to add webcam access capability in the app manifest, (https://learn.microsoft.com/en-us/windows/uwp/packaging/app-capability-declarations). Good job identifying the access denied reason. Given that I just googled `uwp access` and ended up at referenced page. – Cheers and hth. - Alf Sep 27 '17 at 09:01
  • 1
    I already added Webcam capability, I also mentioned that in the question.... – nrofis Sep 27 '17 at 09:08
  • Uhm, try to get the attention of @hans-passant . – Cheers and hth. - Alf Sep 27 '17 at 17:35
  • Any idea? I'm really stuck – nrofis Oct 03 '17 at 11:55
  • I tried to contact Hans Passant [via a comment](https://stackoverflow.com/questions/3677182/taskbar-location#comment80042613_3677319), plus I added the winapi tag to the question, which possibly might make it visible to folks again. You could try to find a chat room here where UWP is discussed. Failing that, or just to find it, try to ask in [the C++ Lounge](https://chat.stackoverflow.com/rooms/10/loungec). – Cheers and hth. - Alf Oct 03 '17 at 12:21
  • Thanks! Where are the chat rooms? – nrofis Oct 03 '17 at 12:38
  • Try the link I provided. ;-) – Cheers and hth. - Alf Oct 03 '17 at 12:54

0 Answers0