Esempio n. 1
0
        public void Compute(out FloatImage avgDepthIm, out ByteImage mask)
        {
            avgDepthIm = new FloatImage(mAcc32.Width, mAcc32.Height);
            avgDepthIm.Copy(mAcc32);

            for (int r = 0; r < avgDepthIm.Height; r++)
            {
                for (int c = 0; c < avgDepthIm.Width; c++)
                {
                    if (mCount16[c, r] >= 1)
                    {
                        avgDepthIm[c, r] = (float)(avgDepthIm[c, r]) / mCount16[c, r];
                    }
                    else
                    {
                        avgDepthIm[c, r] = 0.0f;
                    }
                    // brett temp debugging
                    //if (avgDepthIm[c, r] == 0 && mMask[c, r] != 0)
                    //    throw new Exception("Should not happen");
                }
            }

            // convert the mask to [0,255]
            mMask.Mult(255);
            mask = mMask;
        }