from typing import List import numpy as np class YourClass: @staticmethod def _reprojection_error(mask: List[bool], M: np.ndarray, src_pts: np.ndarray, dst_pts: np.ndarray) -> float: """ Computes the reprojection error between the source and destination points. Args: - mask (List[bool]): A list of boolean values indicating whether to use each point pair for the calculation. - M (np.ndarray): A 3x4 projection matrix that maps points from the source image to the destination image. - src_pts (np.ndarray): An Nx2 array containing the source points. - dst_pts (np.ndarray): An Nx2 array containing the destination points. Returns: - error (float): The reprojection error. """ num_points = np.sum(mask) src_pts_3d = np.hstack((src_pts, np.ones((src_pts.shape[0], 1)))) dst_pts_3d = np.hstack((dst_pts, np.ones((dst_pts.shape[0], 1)))) projected_dst_pts_3d = M @ src_pts_3d.T projected_dst_pts_2d = (projected_dst_pts_3d[:2, :] / projected_dst_pts_3d[2, :]).T error_per_point = np.sqrt(np.sum((dst_pts[mask] - projected_dst_pts_2d[mask])**2, axis=1)) error = np.sum(error_per_point) / num_points return error