filters
filters
adjust_gamma(image, gamma=1.0)
Adjusts the gamma of an image.
image (numpy.ndarray): Input image. gamma (float, optional): Gamma value. Defaults to 1.0.
numpy.ndarray: Gamma-adjusted image.
Source code in redesign_pipeline/signal_processing/filters.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
butter_bandpass(lowcut, highcut, fs, order=5)
Butterworth band-pass filter
Parameters
lowcut: float, the lower cutoff frequency in Hz highcut: float, the upper cutoff frequency in Hz fs: float, the sample rate in Hz order: int (optional), the order of the filter. The default is 5.
Returns
b, a: ndarray, the filter coefficients for the Butterworth band-pass filter
Source code in redesign_pipeline/signal_processing/filters.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
butter_bandpass_filter(src_signal, lowcut, highcut, order, fps)
Butterworth band-pass filter in Python. The filter is designed to pass a band of frequencies between the lower and upper cutoff frequencies, while rejecting frequencies outside of the band.
Parameters
src_signal: ndarray, the source signal to be filtered fps: float, the sample rate in Hz of the source signal. May need to be changed.
Returns
y: ndarray, the filtered signal
Source code in redesign_pipeline/signal_processing/filters.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
moving_average(src_signal, window_size, padding=True)
Calculates the moving average of a signal.
src_signal (ndarray): Source signal. window_size (int): Size of the moving window. padding (bool, optional): Flag to indicate whether padding should be applied. Defaults to True.
ndarray: Moving average of the signal.
Source code in redesign_pipeline/signal_processing/filters.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
moving_average_bvp(src_signal, window_size, padding=True)
Calculates the moving average of BVP (Blood Volume Pulse) signal data for different methods.
src_signal (dict): Dictionary containing BVP signal data for different methods. window_size (int): Size of the moving window. padding (bool, optional): Flag to indicate whether padding should be applied. Defaults to True.
dict: Dictionary containing moving average of BVP signal data for each method.
Source code in redesign_pipeline/signal_processing/filters.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
scale_rgb(src_signal)
Normalizes an RGB image signal. The purpose of normalizing an image signal is to bring its values within a specified range.
src_signal (numpy.ndarray): Input RGB image signal. This is a numpy array with shape (height, width, 3) where height and width are the dimensions of the image and 3 represents the RGB channels.
numpy.ndarray: Normalized RGB image signal.This is a numpy array with the same shape as the input signal, where all values are divided by 255.
Source code in redesign_pipeline/signal_processing/filters.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
standardize(src_signal)
Returns a standardized signal
Parameters
src_signal : signal to standardize
Source code in redesign_pipeline/signal_processing/filters.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
standardize_bvp(src_signal)
Standardizes BVP (Blood Volume Pulse) signal data for different methods.
src_signal (dict): Dictionary containing BVP signal data for different methods.
dict: Dictionary containing standardized BVP signal data for each method.
Source code in redesign_pipeline/signal_processing/filters.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
threshold_mask(img, RGB_LOW_TH, RGB_HIGH_TH)
Creates a binary mask by thresholding an image.
img (numpy.ndarray): Input image. RGB_LOW_TH (tuple): Lower threshold values for RGB channels. RGB_HIGH_TH (tuple): Upper threshold values for RGB channels.
numpy.ndarray: Binary mask.
Source code in redesign_pipeline/signal_processing/filters.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | |