|
@@ -105,6 +105,52 @@ def get_svd_data(data_type, block):
|
|
# convert into numpy array after computing all stats
|
|
# convert into numpy array after computing all stats
|
|
data = np.asarray(data)
|
|
data = np.asarray(data)
|
|
|
|
|
|
|
|
+ if data_type == 'sub_blocks_stats_reduced':
|
|
|
|
+
|
|
|
|
+ block = np.asarray(block)
|
|
|
|
+ width, height, _= block.shape
|
|
|
|
+ sub_width, sub_height = int(width / 4), int(height / 4)
|
|
|
|
+
|
|
|
|
+ sub_blocks = processing.divide_in_blocks(block, (sub_width, sub_height))
|
|
|
|
+
|
|
|
|
+ data = []
|
|
|
|
+
|
|
|
|
+ for sub_b in sub_blocks:
|
|
|
|
+
|
|
|
|
+ # by default use the whole lab L canal
|
|
|
|
+ l_svd_data = np.array(processing.get_LAB_L_SVD_s(sub_b))
|
|
|
|
+
|
|
|
|
+ # get information we want from svd
|
|
|
|
+ data.append(np.mean(l_svd_data))
|
|
|
|
+ data.append(np.median(l_svd_data))
|
|
|
|
+ data.append(np.percentile(l_svd_data, 25))
|
|
|
|
+ data.append(np.percentile(l_svd_data, 75))
|
|
|
|
+ data.append(np.var(l_svd_data))
|
|
|
|
+
|
|
|
|
+ # convert into numpy array after computing all stats
|
|
|
|
+ data = np.asarray(data)
|
|
|
|
+
|
|
|
|
+ if data_type == 'sub_blocks_area':
|
|
|
|
+
|
|
|
|
+ block = np.asarray(block)
|
|
|
|
+ width, height, _= block.shape
|
|
|
|
+ sub_width, sub_height = int(width / 8), int(height / 8)
|
|
|
|
+
|
|
|
|
+ sub_blocks = processing.divide_in_blocks(block, (sub_width, sub_height))
|
|
|
|
+
|
|
|
|
+ data = []
|
|
|
|
+
|
|
|
|
+ for sub_b in sub_blocks:
|
|
|
|
+
|
|
|
|
+ # by default use the whole lab L canal
|
|
|
|
+ l_svd_data = np.array(processing.get_LAB_L_SVD_s(sub_b))
|
|
|
|
+
|
|
|
|
+ area_under_curve = utils.integral_area_trapz(l_svd_data, dx=50)
|
|
|
|
+ data.append(area_under_curve)
|
|
|
|
+
|
|
|
|
+ # convert into numpy array after computing all stats
|
|
|
|
+ data = np.asarray(data)
|
|
|
|
+
|
|
|
|
|
|
return data
|
|
return data
|
|
|
|
|