From 5459fbca17efad20e433aeaa442df14831f8ac82 Mon Sep 17 00:00:00 2001 From: Nick White Date: Tue, 25 Jun 2019 15:31:22 +0100 Subject: Experimentally adjust wipe threshold according to binarisation level --- preproc/cmd/preprocmulti/main.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/preproc/cmd/preprocmulti/main.go b/preproc/cmd/preprocmulti/main.go index 9c979c3..71bf7d5 100644 --- a/preproc/cmd/preprocmulti/main.go +++ b/preproc/cmd/preprocmulti/main.go @@ -25,7 +25,7 @@ func main() { ksizes := []float64{0.2, 0.3, 0.4, 0.5, 0.6} flag.Usage = func() { - fmt.Fprintf(os.Stderr, "Usage: preprocmulti [-bt bintype] [-bw winsize] [-m minperc] [-nowipe] [-wt wipethresh] [-ws wipesize] inimg outbase\n") + fmt.Fprintf(os.Stderr, "Usage: preprocmulti [-bt bintype] [-bw winsize] [-m minperc] [-nowipe] [-ws wipesize] inimg outbase\n") fmt.Fprintf(os.Stderr, "Binarize and preprocess an image, with multiple binarisation levels,\n") fmt.Fprintf(os.Stderr, "saving images to outbase_bin{k}.png.\n") fmt.Fprintf(os.Stderr, "Binarises with these levels for k: %v.\n", ksizes) @@ -36,7 +36,6 @@ func main() { min := flag.Int("m", 30, "Minimum percentage of the image width for the content width calculation to be considered valid.") nowipe := flag.Bool("nowipe", false, "Disable wiping completely.") wipewsize := flag.Int("ws", 5, "Window size for wiping algorithm.") - thresh := flag.Float64("wt", 0.05, "Threshold for the wiping algorithm to determine the proportion of black pixels below which a window is determined to be the edge.") flag.Parse() if flag.NArg() < 2 { flag.Usage() @@ -82,7 +81,7 @@ func main() { if ! *nowipe { log.Print("Wiping sides") - clean = preproc.Wipe(threshimg.(*image.Gray), *wipewsize, *thresh, *min) + clean = preproc.Wipe(threshimg.(*image.Gray), *wipewsize, k * 0.02, *min) } else { clean = threshimg } -- cgit v1.2.1-24-ge1ad