CCT.NUI.Core.Video.DepthImageFactoryBase.CreateHistogram C# (CSharp) Method

CreateHistogram() private method

private CreateHistogram ( IntPtr sourceData, int width, int height ) : void
sourceData System.IntPtr
width int
height int
return void
        protected unsafe void CreateHistogram(IntPtr sourceData, int width, int height)
        {
            try
            {
                this.histogram.Reset();

                int points = 0;
                var pDepth = (ushort*)sourceData.ToPointer();
                for (int y = 0; y < height; ++y)
                {
                    for (int x = 0; x < width; ++x, ++pDepth)
                    {
                        ushort depthVal = *pDepth;
                        if (depthVal > 0)
                        {
                            this.histogram.Increase(depthVal);
                            points++;
                        }
                    }
                }
                this.histogram.PostProcess(points);
            }
            catch (AccessViolationException)
            { }
            catch (SEHException)
            { }
        }
    }