示例#1
0
        /// <summary>
        /// Load a reference image from disk.
        /// </summary>
        /// <param name="filename">Name of the image file to load.</param>
        /// <exception cref="System.ArgumentNullException"></exception>
        /// <exception cref="System.ArgumentException"></exception>
        public ReferenceImage(string filename)
        {
            Validation.CheckString("filename", filename);

            image = new TiledImage(filename,8);
            BlockSize = image.TileSize;

            int totalTiles = image.Width * image.Height;
            Dimension = (int)Math.Floor(Math.Pow(totalTiles, (double)1 / 3));
            latticeCoefficient = (float)255 / (Dimension - 1);
        }
示例#2
0
        /// <summary>
        /// Load a reference image from disk.
        /// </summary>
        /// <param name="filename">Name of the image file to load.</param>
        /// <exception cref="System.ArgumentNullException"></exception>
        /// <exception cref="System.ArgumentException"></exception>
        public ReferenceImage(string filename)
        {
            Validation.CheckString("filename", filename);

            image     = new TiledImage(filename, 8);
            BlockSize = image.TileSize;

            int totalTiles = image.Width * image.Height;

            Dimension          = (int)Math.Floor(Math.Pow(totalTiles, (double)1 / 3));
            latticeCoefficient = (float)255 / (Dimension - 1);
        }
示例#3
0
        /// <summary>
        /// Create a new instance.
        /// </summary>
        /// <param name="dimension">Number of lattice points per dimension in the cube representing the color space.  Minimum is 2.  Maximum is 255.</param>
        /// <param name="blockSize">Length in pixels of 1 side of the sample block for each color in the reference file.</param>
        /// <exception cref="System.ArgumentOutOfRangeException"></exception>
        /// <exception cref="System.InvalidOperationException"></exception>
        public ReferenceImage(int dimension, int blockSize)
        {
            Validation.CheckInteger("dimension", dimension, 2, 255);
            Validation.CheckInteger("blockSize", blockSize, 1);

            Dimension = dimension;
            BlockSize = blockSize;
            this.latticeCoefficient = (float)255 / (dimension - 1);

            int blocks = dimension * dimension * dimension;  //probably faster than System.Math.Pow
            int rows   = (int)Math.Ceiling((float)blocks / 8);

            image = new TiledImage(blockSize, 8, rows);

            generateSamples();
        }
示例#4
0
        /// <summary>
        /// Create a new instance.
        /// </summary>
        /// <param name="dimension">Number of lattice points per dimension in the cube representing the color space.  Minimum is 2.  Maximum is 255.</param>
        /// <param name="blockSize">Length in pixels of 1 side of the sample block for each color in the reference file.</param>
        /// <exception cref="System.ArgumentOutOfRangeException"></exception>
        /// <exception cref="System.InvalidOperationException"></exception>
        public ReferenceImage(int dimension, int blockSize)
        {
            Validation.CheckInteger("dimension", dimension, 2, 255);
            Validation.CheckInteger("blockSize", blockSize, 1);

            Dimension = dimension;
            BlockSize = blockSize;
            this.latticeCoefficient = (float)255 / (dimension - 1);

            int blocks = dimension*dimension*dimension;  //probably faster than System.Math.Pow
            int rows = (int)Math.Ceiling((float)blocks / 8);

            image = new TiledImage(blockSize, 8, rows);

            generateSamples();
        }