-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDecoding.py
More file actions
31 lines (26 loc) · 1.01 KB
/
Decoding.py
File metadata and controls
31 lines (26 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""Decoding
Decoding functions for time of flight coding schemes.
"""
#### Python imports
#### Library imports
import numpy as np
from IPython.core import debugger
breakpoint = debugger.set_trace
#### Local imports
import Utils
def DecodeXCorr(b_measurements, norm_corrfs):
"""DecodeXCorr: Generic decoding algorithm that performs a 1D search on the normalized
correlation functions.
Args:
b_measurements (np.ndarray): B x K matrix. B sets of K brightness measurements
norm_corrfs (np.ndarray): N x K matrix. Normalized Correlation functions. Zero mean
unit variance.
Returns:
np.array: decoded_depths
"""
(n_measurements, k) = b_measurements.shape
## Normalize Brightness Measurements functions
norm_b_measurements = Utils.NormalizeBrightnessVals(b_measurements)
## Calculate the cross correlation for every measurement and the maximum one will be the depth
decoded_depths = np.argmax(np.dot(norm_corrfs, norm_b_measurements.transpose()), axis=0)
return decoded_depths