Skip to content

Commit

Permalink
Merge pull request #394 from sbrunner/fix-cli-arguments
Browse files Browse the repository at this point in the history
Fix the argument passing to the determine_skew function
  • Loading branch information
sbrunner authored Apr 5, 2023
2 parents 712803e + b398289 commit b50eac7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions deskew/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ def main() -> None:
parser = argparse.ArgumentParser()

parser.add_argument("-o", "--output", default=None, help="Output file name")
parser.add_argument("--sigma", default=3.0, help="The use sigma")
parser.add_argument("--num-peaks", default=20, help="The used number of peaks")
parser.add_argument("--sigma", default=3.0, type=float, help="The use sigma")
parser.add_argument("--num-peaks", default=20, type=int, help="The used number of peaks")
parser.add_argument(
"--num-angles", default=180, help="The used number of angle (determine the precision)"
"--num-angles", default=180, type=int, help="The used number of angle (determine the precision)"
)
parser.add_argument("--background", help="The used background color")
parser.add_argument(default=None, dest="input", help="Input file name")
options = parser.parse_args()

image = io.imread(options.input)
grayscale = image if len(image.shape) == 2 else rgb2gray(image)
angle = determine_skew(grayscale, sigma=options.sigma, num_peaks=options.num_peaks)
angle = determine_skew(
grayscale, sigma=options.sigma, num_peaks=options.num_peaks, num_angles=options.num_angles
)
if options.output is None:
print(f"Estimated angle: {angle}")
else:
Expand Down

0 comments on commit b50eac7

Please sign in to comment.