Пример #1
0
        /// <summary>
        /// Method to convert GetArrayBinary from data type double[,,] to int[]
        /// </summary>
        /// <returns></returns>
        private static T[] GetArray <T>(ImageBinarizer imageBinarizer)
        {
            var doubleArray = imageBinarizer.GetArrayBinary();
            var hg          = doubleArray.GetLength(1);
            var wd          = doubleArray.GetLength(0);

            T[] intArray = new T[hg * wd];

            for (int j = 0; j < hg; j++)
            {
                for (int i = 0; i < wd; i++)
                {
                    intArray[j * wd + i] = (T)Convert.ChangeType(doubleArray[i, j, 0], typeof(int));
                }
            }
            return(intArray);
        }
Пример #2
0
 /// <summary>
 /// Gets the image pixels.
 /// </summary>
 /// <returns>double 3D array of greyscale value</returns>
 public double[,,] GetPixels()
 {
     return(imageBinarizer.GetArrayBinary());
 }