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)
{ }
}
}