Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

What is Windows.Media.IVideoFrameStatics?

I try to implement faceTacker into the hololens. For that I use HololensCameraStream, because MediaCapture use CaptureElement which from XAML. My problem is when I implement videoFrame for FaceTracker I have this error :

System.InvalidCastException: Unable to cast object of type 'System.__ComObject' to type 'Windows.Media.IVideoFrameStatics'. at System.StubHelpers.StubHelpers.GetCOMIPFromRCW_WinRT(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget) at Windows.Media.VideoFrame.CreateWithSoftwareBitmap(SoftwareBitmap bitmap) at test02.OnFrameSampleAcquired(VideoCaptureSample sample)

And when I write it on google, I have result about Windows Media Player, so I have no idea what is it and how to resolve it ...

Here is my code :
`void OnFrameSampleAcquired(VideoCaptureSample sample)
{
if (frameSample == null || frameSample.Length < sample.dataLength)
{
frameSample = new byte[sample.dataLength];
}

    sample.CopyRawImageDataIntoBuffer(frameSample);

    IBuffer ibuffer = null;
    if(frameSample != null)
        ibuffer = frameSample.AsBuffer();
    else
        Debug.Log("frameSample null");

    SoftwareBitmap softwareBitmapFrameSample = new SoftwareBitmap(BitmapPixelFormat.Nv12, this._resolution.width, this._resolution.height);
    softwareBitmapFrameSample.CopyFromBuffer(ibuffer);

    if(softwareBitmapFrameSample == null)
        Debug.Log("Failed to create SoftwareBitmap");
    else
        Debug.Log("SoftwareBitmap success");
    try
    {
        Debug.Log("BEFORE VIDEOfRAME");
        VideoFrame videoFrameSample = VideoFrame.CreateWithSoftwareBitmap(softwareBitmapFrameSample);
    }catch(Exception ex){
        Debug.Log(ex);
    }/*
    UnityEngine.WSA.Application.InvokeOnAppThread(() =>
    {

// faces = await this.faceTracker.ProcessNextFrameAsync();
}, false);*/
}`

Thanks for the help

Tagged:
Sign In or Register to comment.