# keypoints

Python API: `depthai_nodes.node.parsers.utils.keypoints`

## Functions

### compute_keypoints

```python
def compute_keypoints(keypoints: np.ndarray, *, n_keypoints: int, scale_factor: float = 1.0) -> np.ndarray:
```

Reshape and normalize a keypoint tensor.

Parameters

 * `keypoints` (`np.ndarray`): Model keypoint tensor.
 * `n_keypoints` (`int`): Number of keypoints encoded per prediction.
 * `scale_factor` (`float`): Nonzero divisor used to convert model coordinates to normalized coordinates.

Returns

 * `np.ndarray`: Float32 coordinates of shape `(n_keypoints, 2)` or `(n_keypoints, 3)`, divided by `scale_factor` and clipped to
   [0, 1].

Raises

 * `ValueError`: If the tensor does not contain two or three coordinates per keypoint.

### normalize_keypoints

```python
def normalize_keypoints(keypoints: np.ndarray, height: int, width: int) -> np.ndarray:
```

Normalize keypoint coordinates to (0, 1).

Parameters

 * `keypoints` (`np.ndarray`): A numpy array of shape (N, 2) or (N, K, 2) where N is the number of keypoint sets and K is the
   number of keypoint in each set.
 * `height` (`int`): The height of the image.
 * `width` (`int`): The width of the image.

Returns

 * `np.ndarray`
