/**************************************************************************** * Copyright 2019 Nreal Techonology Limited. All rights reserved. * * This file is part of NRSDK. * * https://www.nreal.ai/ * *****************************************************************************/ namespace NRKernal.Record { using System; using System.Collections.Generic; using UnityEngine; /// Contains information captured from the web camera. public sealed class PhotoCaptureFrame : IDisposable { /// The data. private byte[] data; /// Constructor. /// Describes the format to use. /// The data. public PhotoCaptureFrame(CapturePixelFormat format, byte[] data) { this.data = data; this.pixelFormat = format; } /// Finalizer. ~PhotoCaptureFrame() { } /// The length of the raw IMFMediaBuffer which contains the image captured. /// The length of the data. public int dataLength { get; } /// Specifies whether or not spatial data was captured. /// True if this object has location data, false if not. public bool hasLocationData { get; } /// The raw image data pixel format. /// The pixel format. public CapturePixelFormat pixelFormat { get; } /// Copies the raw image data into buffer described by byteBuffer. /// Buffer for byte data. public void CopyRawImageDataIntoBuffer(List byteBuffer) { } /// Disposes the PhotoCaptureFrame and any resources it uses. public void Dispose() { } /// /// Provides a COM pointer to the native IMFMediaBuffer that contains the image data. /// A native COM pointer to the IMFMediaBuffer which contains the image data. public IntPtr GetUnsafePointerToBuffer() { return IntPtr.Zero; } /// Attempts to get camera to world matrix. /// [out] The camera to world matrix. /// True if it succeeds, false if it fails. public bool TryGetCameraToWorldMatrix(out Matrix4x4 cameraToWorldMatrix) { cameraToWorldMatrix = Matrix4x4.identity; return true; } /// Attempts to get projection matrix. /// [out] The projection matrix. /// True if it succeeds, false if it fails. public bool TryGetProjectionMatrix(out Matrix4x4 projectionMatrix) { projectionMatrix = Matrix4x4.identity; return true; } /// Attempts to get projection matrix. /// The near clip plane. /// The far clip plane. /// [out] The projection matrix. /// True if it succeeds, false if it fails. public bool TryGetProjectionMatrix(float nearClipPlane, float farClipPlane, out Matrix4x4 projectionMatrix) { projectionMatrix = Matrix4x4.identity; return true; } /// /// This method will copy the captured image data into a user supplied texture for use in Unity. /// The target texture that the captured image data will be copied to. public void UploadImageDataToTexture(Texture2D targetTexture) { if (data == null) { return; } ImageConversion.LoadImage(targetTexture, data); } } }