Example #1
0
            private static IMarshaler MarshalInner(DepthMetaData obj, bool marshalOut)
            {
                IMarshaler inner = ((MapMetaData)obj).GetMarshaler(marshalOut);

                obj.depth.pMap = inner.Native;
                return(inner);
            }
    protected override bool InitTexture(out Texture2D refText, out int xSize, out int ySize)
    {
        if (base.InitTexture(out refText, out xSize, out ySize) == false)
        {
            return(false);
        }
        if (m_settingManager.CurrentContext.Depth == null)
        {
            m_settingManager.m_logger.Log("No depth", UNIEventLogger.Categories.Initialization, UNIEventLogger.Sources.BaseObjects, UNIEventLogger.VerboseLevel.Errors);
            return(false);
        }
        if (m_factor <= 0)
        {
            m_settingManager.m_logger.Log("Illegal factor", UNIEventLogger.Categories.Initialization, UNIEventLogger.Sources.BaseObjects, UNIEventLogger.VerboseLevel.Errors);
            return(false);
        }

        MapOutputMode mom = m_settingManager.CurrentContext.Depth.MapOutputMode;

        xSize   = mom.XRes / m_factor;
        ySize   = mom.YRes / m_factor;
        refText = new Texture2D(xSize, ySize);

        //depthmap data
        rawDepthMap = new short[(int)(mom.XRes * mom.YRes)];
        //histogram stuff
        int maxDepth = m_settingManager.CurrentContext.Depth.DeviceMaxDepth;

        depthHistogramMap = new float[maxDepth];

        UNIOpenNICheckVersion.Instance.ValidatePrerequisite();
        m_depthMetaData = new DepthMetaData();

        return(true);
    }
Example #3
0
    void Start()
    {
        settingsManager = FindObjectOfType(typeof(OpenNISettingsManager)) as OpenNISettingsManager;

        if (!settingsManager.UserGenrator.Valid || settingsManager.CurrentContext.Depth == null)
        {
            update = false;
            return;
        }

        depthGenerator = new OpenNI.DepthGenerator(settingsManager.CurrentContext.BasicContext);

        OpenNI.MapOutputMode mapOutputMode = settingsManager.CurrentContext.Depth.MapOutputMode;
        width   = mapOutputMode.XRes / factor;
        height  = mapOutputMode.YRes / factor;
        texture = new Texture2D(width, height);

        depthMap          = new short[(int)(mapOutputMode.XRes * mapOutputMode.YRes)];
        depthHistogramMap = new float[settingsManager.CurrentContext.Depth.DeviceMaxDepth];

        NIOpenNICheckVersion.Instance.ValidatePrerequisite();
        metaData = new OpenNI.DepthMetaData();

        mapPixels = new Color[width * height];
    }
Example #4
0
        public DepthMetaData GetMetaData()
        {
            DepthMetaData depthMD = new DepthMetaData();

            GetMetaData(depthMD);
            return(depthMD);
        }
Example #5
0
 public void GetMetaData(DepthMetaData depthMD)
 {
     using (IMarshaler marsh = depthMD.GetMarshaler(true))
     {
         SafeNativeMethods.xnGetDepthMetaData(this.InternalObject, marsh.Native);
     }
 }
Example #6
0
 public DepthMetaDataMarshaler(DepthMetaData obj, bool marshalOut) :
     base(obj.depth, marshalOut,
          MarshalInner(obj, marshalOut))
 {
 }
 public void SetData(DepthMetaData depthMD)
 {
     SetData(depthMD, depthMD.FrameID, depthMD.Timestamp);
 }
 public void SetData(DepthMetaData depthMD, Int32 frameID, Int64 timestamp)
 {
     SetData(frameID, timestamp, depthMD.DataSize, depthMD.DepthMapPtr);
 }