Simple OO refactor

This commit is contained in:
Kristóf Tóth 2018-02-24 20:04:44 +01:00
parent 50d022380b
commit 395729aca1

View File

@ -4,12 +4,15 @@ import numpy as np
from argparse import ArgumentParser
def laplacian_variance(image):
return cv2.Laplacian(image, cv2.CV_64F).var()
class imgrate:
def __init__(self, image=None):
self.image = image
def laplacian_variance(self):
return cv2.Laplacian(self.image, cv2.CV_64F).var()
def fdibm(image):
F = np.fft.fft2(image)
def fdibm(self):
F = np.fft.fft2(self.image)
Fcentered = np.fft.fftshift(F)
Fabs = np.abs(Fcentered)
Fmax = Fabs.max()
@ -25,4 +28,4 @@ if __name__ == '__main__':
image = cv2.imread(args.images[0])
grayscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
print(fdibm(grayscale))
print(imgrate(grayscale).fdibm())