Skip to content

Registration

Registration类

  • 初始化

Parameters:

Name Type Description Default
method str

求解方法

'helmert'
Source code in src/gotrackit/tools/registration.py
10
11
12
13
14
15
16
17
18
19
20
21
def __init__(self, method: str = 'helmert'):
    """Registration类

    - 初始化

    Args:
        method: 求解方法
    """
    self.method = method

    # 初始化仿射变换矩阵
    self.convert_mat = np.ndarray

Registration类方法 - generate_convert_mat

  • 依据 像素坐标组 以及 对应的真实坐标组 计算仿射变换矩阵

Parameters:

Name Type Description Default
pixel_loc_array ndarray

像素坐标组, np.array([[x1, y1], [x2, y2], ...])

None
actual_loc_array ndarray

真实坐标组, np.array([[x1, y1], [x2, y2], ...])

None

Returns:

Source code in src/gotrackit/tools/registration.py
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
def generate_convert_mat(self, pixel_loc_array: np.ndarray = None, actual_loc_array: np.ndarray = None) -> None:
    """Registration类方法 - generate_convert_mat

    - 依据 像素坐标组 以及 对应的真实坐标组 计算仿射变换矩阵

    Args:
        pixel_loc_array: 像素坐标组, np.array([[x1, y1], [x2, y2], ...])
        actual_loc_array: 真实坐标组, np.array([[x1, y1], [x2, y2], ...])

    Returns:

    """
    assert pixel_loc_array.shape[0] == actual_loc_array.shape[0]

    # n组配对坐标
    n = pixel_loc_array.shape[0]
    assert n >= 3, 'at least 3 sets of matching point information'

    if self.method == 'helmert':
        self.helmert_method(pixel_loc_array=pixel_loc_array, actual_loc_array=actual_loc_array, n=n)
    else:
        self.six_parameter_method(pixel_loc_array=pixel_loc_array, actual_loc_array=actual_loc_array, n=n)

Registration类方法 - coords_convert

  • 将像素坐标转换为真实世界坐标

Parameters:

Name Type Description Default
x float

x坐标

None
y float

y坐标

None

Returns:

Type Description
ndarray

(x, y)

Source code in src/gotrackit/tools/registration.py
139
140
141
142
143
144
145
146
147
148
149
150
151
def coords_convert(self, x: float = None, y: float = None) -> np.ndarray:
    """Registration类方法 - coords_convert

    - 将像素坐标转换为真实世界坐标

    Args:
        x: x坐标
        y: y坐标

    Returns:
        (x, y)
    """
    return np.dot(np.array([[x, y, 1]]), self.convert_mat)[0][:2]

Comments