From 9c3b03c8457d6eff75a90a49638b23887edcdb57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjist=C3=B3f?= Date: Mon, 1 Jan 2018 16:33:10 +0100 Subject: [PATCH] initial commit --- imgrate.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 imgrate.py diff --git a/imgrate.py b/imgrate.py new file mode 100755 index 0000000..ba68dd5 --- /dev/null +++ b/imgrate.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +import cv2 +from argparse import ArgumentParser + + +def laplacian_variance(image): + grayscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) + return cv2.Laplacian(grayscale, cv2.CV_64F).var() + + +if __name__ == '__main__': + ap = ArgumentParser() + ap.add_argument('images', type=str, nargs='+', help='') + args = ap.parse_args() + + image = cv2.imread(args.images[0]) + + print(laplacian_variance(image)) \ No newline at end of file