summaryrefslogtreecommitdiff
path: root/preproc/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'preproc/cmd')
-rw-r--r--preproc/cmd/preprocmulti/main.go13
1 files changed, 7 insertions, 6 deletions
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 {