Action_Recognition_2._0.FeatureExtractor2D.FixFrame C# (CSharp) Method

FixFrame() private method

Grayscale and crop frames
private FixFrame ( Bitmap map ) : Matrix
map System.Drawing.Bitmap
return Matrix
        private Matrix FixFrame(Bitmap map)
        {
            int scalar = 1 / 255;
            int rowBound = (int)Math.Floor((double)(map.Width/SpatialSize)) * SpatialSize;
            int colBound = (int)Math.Floor((double)(map.Height/SpatialSize)) * SpatialSize;
            Matrix M;

            map = rgb2gray(map);
            M = ToMatrix(map);
            M = M.timesEquals(scalar);      //divide each value in the Matrix by 255. Note that scalar has a value of 1/255
            M = M.getMatrix(1, rowBound, 1, colBound);
            return M;
        }