18 lines
432 B
Python
Executable File
18 lines
432 B
Python
Executable File
#!/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)) |