示例#1
0
        public static void GetOtsuThreshold(byte[,] matrix, out byte[,] m2, out int threshold)
        {
            int width  = matrix.GetLength(1);
            int height = matrix.GetLength(0);

            byte[] vector = DataTools.Matrix2Array(matrix);

            // Create Otsu Thresholder
            OtsuThresholder thresholder = new OtsuThresholder();

            threshold = thresholder.CalculateThreshold(vector, out var outputArray);
            m2        = DataTools.Array2Matrix(outputArray, width, height);
        }
示例#2
0
        public static void GetOtsuThreshold(byte[,] matrix, out byte[,] m2, out int threshold, out Image <Rgb24> histogramImage)
        {
            int width  = matrix.GetLength(1);
            int height = matrix.GetLength(0);

            byte[] vector = DataTools.Matrix2Array(matrix);

            // Create Otsu Thresholder
            OtsuThresholder thresholder = new OtsuThresholder();

            threshold      = thresholder.CalculateThreshold(vector, out var outputArray);
            m2             = DataTools.Array2Matrix(outputArray, width, height);
            histogramImage = CreateHistogramFrame(thresholder, height, 256);
        }