Skip to content

Commit 7436127

Browse files
committed
Added FeatureVectors class
1 parent d712ca1 commit 7436127

File tree

2 files changed

+179
-0
lines changed

2 files changed

+179
-0
lines changed

FeatureVectors.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import numpy as np
2+
3+
4+
class FeatureVectors():
5+
6+
def __init__(self, image):
7+
self.image = image
8+
9+
def __getMeanIntensity(self):
10+
meanIntensity = []
11+
for channel in range(3):
12+
channel_mean = np.average(self.image[:, :, channel])
13+
meanIntensity.append(round(channel_mean, 5))
14+
15+
return meanIntensity
16+
17+
def __getStdIntensity(self):
18+
stdIntensity = []
19+
for channel in range(3):
20+
channel_std = np.std(self.image[:, :, channel])
21+
stdIntensity.append(round(channel_std, 5))
22+
23+
return stdIntensity
24+
25+
def getFeatureVector(self):
26+
featureVectors = []
27+
meanIntensity = self.__getMeanIntensity()
28+
stdIntensity = self.__getStdIntensity()
29+
30+
featureVectors = meanIntensity+stdIntensity
31+
return featureVectors

ImageFeatureVectors.ipynb

Lines changed: 148 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)