Exemplo n.º 1
0
        private Matrix3D FileToMatrix3D(FileInfo file)
        {
            var picture = new Bitmap(file.FullName);

            if (_pictureWidth != picture.Width || _pictureHeight != picture.Height)
            {
                throw new InvalidOperationException($"Picture at {file.FullName} is not of proper size " +
                                                    $"should be {_pictureWidth}x{_pictureHeight}, " +
                                                    $"recieved {picture.Width}x{picture.Height}");
            }


            return(_rgb ? picture.AsMatrixRGB() : picture.AsMatrixGrayscale());
        }
Exemplo n.º 2
0
        public void PushInput(Bitmap bm)
        {
            if (bm.Height != OutputHeight || bm.Width != OutputWidth)
            {
                throw new ArgumentException("Bitmap is not of proper size");
            }

            if (_rgb)
            {
                _output = bm.AsMatrixRGB();
            }
            else
            {
                _output = bm.AsMatrixGrayscale();
            }
        }