Samuel Schmidt commited on
Commit
e4ec374
·
1 Parent(s): fe476eb

Update src/helper.py

Browse files
Files changed (1) hide show
  1. src/helper.py +10 -0
src/helper.py CHANGED
@@ -21,3 +21,13 @@ def euclidean_distance(x, y):
21
  # return the Euclidean distance
22
  return d
23
 
 
 
 
 
 
 
 
 
 
 
 
21
  # return the Euclidean distance
22
  return d
23
 
24
+ def merge_features(feature1, feature2):
25
+ # pad or truncate hist_color and hist_lbp to the same length
26
+ max_length = max(feature1.shape[0], feature2.shape[0])
27
+ feature1_padded = np.pad(hist_color, (0, max_length - hist_color.shape[0]))
28
+ feature2_padded = np.pad(hist_lbp, (0, max_length - hist_lbp.shape[0]))
29
+
30
+ # concatenate the padded feature vectors
31
+ return np.hstack((hist_color_padded, hist_lbp_padded))
32
+
33
+