1
1
import cv2
2
2
import numpy as np
3
+ from Image_Filters .NoiseReduction import NoiseReduction
4
+ from Image_Filters .ConvolutionalFilters import ConvolutionFilter
3
5
4
6
5
7
class FeatureVectors ():
6
8
7
9
def __init__ (self , image ):
8
- self .image = image
10
+ self .filter = NoiseReduction (image )
11
+ self .image = self .filter .applyGaussianBlur ()
9
12
10
13
def __getMeanIntensity (self ):
11
14
meanIntensity = []
@@ -25,12 +28,19 @@ def __getStdIntensity(self):
25
28
26
29
def __getRGBHistogramVector (self ):
27
30
histogram_3d = cv2 .calcHist ([self .image ], [0 , 1 , 2 ], None ,
28
- [8 , 8 , 8 ], [0 , 256 , 0 , 256 , 0 , 256 ])
31
+ [12 , 12 , 12 ], [0 , 256 , 0 , 256 , 0 , 256 ])
29
32
histogram_3d = histogram_3d .ravel ()
30
33
RGBHistogram = list (histogram_3d )
31
34
32
35
return RGBHistogram
33
36
37
+ def __getHuMoments (self ):
38
+ filter = ConvolutionFilter (self .image )
39
+ canny_filtered = filter .applyCannyEdge ()
40
+ canny_huMoments = cv2 .HuMoments (cv2 .moments (canny_filtered )).flatten ()
41
+ huVector = list (canny_huMoments .ravel ())
42
+ return huVector
43
+
34
44
def getFeatureVector (self ):
35
45
featureVectors = []
36
46
meanIntensity = self .__getMeanIntensity ()
0 commit comments