HoloLens - 当可定位摄像机处于VideoMode(流媒体)时捕获照片

时间:2017-05-29 10:35:12

标签: c# .net webcam hololens

我正在尝试创建一个HoloLens应用程序,该应用程序使用内置的WebCam拍摄照片并将其发送到休息界面以进一步识别脸部。到目前为止这种方法运作良好。要从WebCam捕获照片,它需要位于 PhotoMode

问题: 如果我现在想要通过实时流呈现我的应用程序,则WebCam会自动设置为 VideoMode ,并且无法捕获照片。 可定位的相机说明https://developer.microsoft.com/en-us/windows/mixed-reality/locatable_camera_in_unity说:

  

“一次只能对相机进行一次操作。”

由于应用程序必须呈现给很多人,因此通过实时流程显示它是绝对必要的。

有人有任何一般性的想法如何解决这个问题,或者可能有些黑客同时访问 PhotoMode 中的WebCam到流媒体?

非常感谢提前!

1 个答案:

答案 0 :(得分:0)

This is possible if you can live with Preview Frames from the MediaCapture streams. Just start the video capture (layer on holograms if you need to), and then use the PreviewFrames as your 'photos'. This limits you to the resolution of the camera stream of course.

I was able to get this plugin working on a HoloLens. Had to use .Net instead of IL2CPP and I used 2017.4.22f1. At the very least the code shows how use MediaCapture and PreviewFrames to get a video feed from the camera for which you can grab the current frame to save as a photo. The sample doesn't do that last bit, but the bytes for the frames are being passed around, just need to make them available for your need. =)

https://github.com/VulcanTechnologies/HoloLensCameraStream