Hololens - Access Camera Frames

我们两清 提交于 2019-12-01 05:29:11

问题


How can I access all frames in a video stream from the hololens camera, when in 3D mode? I'm using C#.

The unity VideoCapture class doesn't seem to provide this: http://docs.unity3d.com/550/Documentation/ScriptReference/VR.WSA.WebCam.VideoCapture.html

and the microsoft MediaCapture class with method MediaCapture.StartPreviewToCustomSinkAsync is not very well documented. https://msdn.microsoft.com/en-us/library/windows/desktop/ms701626(v=vs.85).aspx


回答1:


You can try using the MediaCapture FrameReader API

Documentation: https://msdn.microsoft.com/en-gb/windows/uwp/audio-video-camera/process-media-frames-with-mediaframereader#create-a-frame-reader-for-the-frame-source

Sample code: https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/CameraFrames




回答2:


We made an open source project called CameraStream to address this need. As a Unity plugin, it uses MediaCapture to feed the byte array into Unity (along with locatable matrices). From there you can assign the bytes to a Texture2D, as shown in the provided Unity example.

Our VideoCapture class mimic's Unity's class of the same name so that developers would be familiar with how to use it. We're also assuming that this functionality will be provided by Unity out-of-the-box eventually.



来源:https://stackoverflow.com/questions/39372167/hololens-access-camera-frames

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!