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); }
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); }