aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-08-30 01:57:00 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-08-30 01:57:00 +0300
commit61f13a8708cfb0adadf31b3d1ffe5f70b1103e0f (patch)
tree5386c793836e85801fd2c9116b83b191247c63b5 /bin
parentfactor common code out (diff)
downloadfilters-61f13a8708cfb0adadf31b3d1ffe5f70b1103e0f.tar.gz
filters-61f13a8708cfb0adadf31b3d1ffe5f70b1103e0f.zip
more useful help messages + README update
Diffstat (limited to 'bin')
-rw-r--r--bin/box_blur.py12
-rw-r--r--bin/gaussian_blur.py15
-rw-r--r--bin/shift.py19
3 files changed, 26 insertions, 20 deletions
diff --git a/bin/box_blur.py b/bin/box_blur.py
index 9d5d1cd..d570f5a 100644
--- a/bin/box_blur.py
+++ b/bin/box_blur.py
@@ -22,13 +22,15 @@ def _main_box_blur(img_path, radius=DEFAULT_RADIUS, output_path=None):
image.save(output_path, output)
def _parse_args(args=sys.argv):
- parser = argparse.ArgumentParser()
- parser.add_argument('img_path')
- parser.add_argument('--output', '-o',
- dest='output_path', default=None)
+ parser = argparse.ArgumentParser(
+ description='Apply box blur to an image.')
+ parser.add_argument('img_path', help='source image file path')
+ parser.add_argument('--output', '-o', dest='output_path', default=None,
+ help='save new image to a file')
parser.add_argument('--radius', '-r',
type=cmd_line.parse_non_negative_integer,
- default=DEFAULT_RADIUS)
+ default=DEFAULT_RADIUS,
+ help='specify convolution kernel radius')
return parser.parse_args(args[1:])
def _main(args=sys.argv):
diff --git a/bin/gaussian_blur.py b/bin/gaussian_blur.py
index d530547..c2aa79a 100644
--- a/bin/gaussian_blur.py
+++ b/bin/gaussian_blur.py
@@ -26,15 +26,18 @@ def _main_gaussian_blur(
image.save(output_path, output)
def _parse_args(args=sys.argv):
- parser = argparse.ArgumentParser()
- parser.add_argument('img_path')
- parser.add_argument('--output', '-o',
- dest='output_path', default=None)
+ parser = argparse.ArgumentParser(
+ description='Apply Gaussian blur to an image.')
+ parser.add_argument('img_path', help='source image file path')
+ parser.add_argument('--output', '-o', dest='output_path', default=None,
+ help='save new image to a file')
parser.add_argument('--sigma', '-s',
- type=float, default=DEFAULT_SIGMA)
+ type=float, default=DEFAULT_SIGMA,
+ help='specify the sigma coefficient in the Gaussian formula')
parser.add_argument('--radius', '-r',
type=cmd_line.parse_non_negative_integer,
- default=DEFAULT_RADIUS)
+ default=DEFAULT_RADIUS,
+ help='specify convolution kernel radius')
return parser.parse_args(args[1:])
def _main(args=sys.argv):
diff --git a/bin/shift.py b/bin/shift.py
index 8dfd76a..94db333 100644
--- a/bin/shift.py
+++ b/bin/shift.py
@@ -32,17 +32,18 @@ def _parse_direction(s):
raise argparse.ArgumentTypeError('invalid direction: ' + s)
def _parse_args(args=sys.argv):
- parser = argparse.ArgumentParser()
- parser.add_argument('img_path')
- parser.add_argument('--output', '-o',
- dest='output_path', default=None)
- parser.add_argument('--direction', '-d',
- type=_parse_direction,
- choices=Direction,
- default=DEFAULT_DIRECTION)
+ parser = argparse.ArgumentParser(
+ description='Shift an image by a few pixels in a specified direction.')
+ parser.add_argument('img_path', help='source image file path')
+ parser.add_argument('--output', '-o', dest='output_path', default=None,
+ help='save new image to a file')
+ parser.add_argument('--direction', '-d', choices=Direction,
+ type=_parse_direction, default=DEFAULT_DIRECTION,
+ help='specify shifting direction')
parser.add_argument('--distance', '-n',
type=cmd_line.parse_non_negative_integer,
- default=DEFAULT_DISTANCE)
+ default=DEFAULT_DISTANCE,
+ help='specify shift size (in pixels)')
return parser.parse_args(args[1:])
def _main(args=sys.argv):