summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick White <git@njw.name>2019-06-25 15:31:22 +0100
committerNick White <git@njw.name>2019-06-25 15:31:22 +0100
commit5459fbca17efad20e433aeaa442df14831f8ac82 (patch)
treeb184976588035755fac33f3efd4afd5bb08f0220
parent6d9659e826eb6977a5ee4b4abc8be902a91294f1 (diff)
Experimentally adjust wipe threshold according to binarisation level
-rw-r--r--preproc/cmd/preprocmulti/main.go5
1 files 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
}