-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathphenome.py
56 lines (40 loc) · 987 Bytes
/
phenome.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
os.getcwd()
from modules.image_handler import load_img
from matplotlib import pyplot as plt
import numpy as np
from scipy.signal import convolve2d
class Imager():
def __init__(self, path):
self.shape = None
self.h = 0
self.w = 0
self.c = 0
self.img = self.load(path)
def load(self, path):
return load_img(path)
def show(self):
plt.imshow(self.img)
def get_blur(self):
k_gauss = np.array((
[1, 4, 1],
[4, 9, 4],
[1, 4, 1]),
dtype='int') / 29
return convolve2d(self.img[:, :, 0], k_gauss, mode="same")
obj = Imager("data/plots.jpg")
obj.img
obj_b = obj.get_blur()
plt.imshow(obj_b)
obj.load("path")
# public members
shape
h, w, c
img
# public functions
obj.get_shape() # returns a shape (dimension)
obj.blur() # returns a blurred image
obj.edge() # returns a edge-detected image
obj.show()
# private members
# private functions