From 94601a82bd3db51b749a1e44ad116250ba545bee Mon Sep 17 00:00:00 2001
From: Nick White <git@njw.name>
Date: Tue, 14 May 2019 10:39:22 +0100
Subject: Basic cleanup of preprocmulti

---
 preproc/cmd/preprocmulti/main.go | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

(limited to 'preproc')

diff --git a/preproc/cmd/preprocmulti/main.go b/preproc/cmd/preprocmulti/main.go
index 01afb9b..eea7ab4 100644
--- a/preproc/cmd/preprocmulti/main.go
+++ b/preproc/cmd/preprocmulti/main.go
@@ -23,16 +23,19 @@ func autowsize(bounds image.Rectangle) int {
 }
 
 func main() {
+	ksizes := []float64{0.2, 0.3, 0.4, 0.5, 0.6}
+
 	flag.Usage = func() {
-		fmt.Fprintf(os.Stderr, "Usage: preproc [-bt bintype] [-bw winsize] [-t thresh] [-ws wipesize] inimg outbase\n")
+		fmt.Fprintf(os.Stderr, "Usage: preproc [-bt bintype] [-bw winsize] [-wt wipethresh] [-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_knum.png.\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)
 		flag.PrintDefaults()
 	}
 	binwsize := flag.Int("bw", 0, "Window size for sauvola binarization algorithm. Set automatically based on resolution if not set.")
 	btype := flag.String("bt", "binary", "Type of binarization threshold. binary or zeroinv are currently implemented.")
 	wipewsize := flag.Int("ws", 5, "Window size for wiping algorithm.")
-	thresh := flag.Float64("t", 0.05, "Threshold for the proportion of black pixels below which a window is determined to be the edge.")
+	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()
@@ -61,8 +64,6 @@ func main() {
 		*binwsize++
 	}
 
-	ksizes := []float64{0.2, 0.3, 0.4, 0.5, 0.6}
-
 	var threshimg image.Image
 	log.Print("Precalculating integral images")
 	integrals := integralimg.ToAllIntegralImg(gray)
@@ -81,7 +82,7 @@ func main() {
 		log.Print("Wiping sides")
 		clean := preproc.Wipe(threshimg.(*image.Gray), *wipewsize, *thresh)
 
-		savefn := fmt.Sprintf("%s_%0.1f.png", flag.Arg(1), k)
+		savefn := fmt.Sprintf("%s_bin%0.1f.png", flag.Arg(1), k)
 		log.Printf("Saving %s\n", savefn)
 		f, err = os.Create(savefn)
 		if err != nil {
-- 
cgit v1.2.1-24-ge1ad