aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin/gaussian_blur.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2017-01-22 09:45:29 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2017-01-22 09:45:29 +0300
commit9aa3f2de19adc2ed2affde008e1252cbc6e1d67e (patch)
tree2040fda4b9dbb979866d9f6a13a8c0a4a6aa9e49 /bin/gaussian_blur.py
parentrevert most of the recent Pylint fixes (diff)
downloadfilters-9aa3f2de19adc2ed2affde008e1252cbc6e1d67e.tar.gz
filters-9aa3f2de19adc2ed2affde008e1252cbc6e1d67e.zip
fix Pylint warnings
Diffstat (limited to 'bin/gaussian_blur.py')
-rw-r--r--bin/gaussian_blur.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/bin/gaussian_blur.py b/bin/gaussian_blur.py
index c2aa79a..f6f01a5 100644
--- a/bin/gaussian_blur.py
+++ b/bin/gaussian_blur.py
@@ -6,14 +6,15 @@
import argparse
import sys
-from .utils import cmd_line, image
from filters.convolution import convolve
from filters.kernel.gaussian_blur import gen_kernel
+from .utils import cmd_line, image
+
DEFAULT_SIGMA = 1.
DEFAULT_RADIUS = 1
-def _main_gaussian_blur(
+def do_gaussian_blur(
img_path, radius=DEFAULT_RADIUS, sigma=DEFAULT_SIGMA,
output_path=None):
@@ -25,7 +26,9 @@ def _main_gaussian_blur(
else:
image.save(output_path, output)
-def _parse_args(args=sys.argv):
+def _parse_args(args=None):
+ if args is None:
+ args = sys.argv[1:]
parser = argparse.ArgumentParser(
description='Apply Gaussian blur to an image.')
parser.add_argument('img_path', help='source image file path')
@@ -38,10 +41,10 @@ def _parse_args(args=sys.argv):
type=cmd_line.parse_non_negative_integer,
default=DEFAULT_RADIUS,
help='specify convolution kernel radius')
- return parser.parse_args(args[1:])
+ return parser.parse_args(args)
-def _main(args=sys.argv):
- _main_gaussian_blur(**vars(_parse_args(args)))
+def main(args=None):
+ do_gaussian_blur(**vars(_parse_args(args)))
if __name__ == '__main__':
- _main()
+ main()