Open lsj1111 opened 6 months ago
您好,存在nan值是正常的,因为输入的图像由于投影仪的角度问题势必发生畸变,对于如下的输入图像
经过匹配和cv2.remap后,最终被投影的结果可能是
图中的黑色部分就是nan
At 2024-04-01 17:03:40, "lsj1111" @.***> wrote:
One-to-one matching of projector image plane coordinates and projected image pixel coordinates
def get_martix(pro_all, real_all, pro_size):
grid_x = np.linspace(0, pro_size[0]-1, pro_size[0]) grid_y = np.linspace(0, pro_size[1]-1, pro_size[1]) grid_x, grid_y = np.meshgrid(grid_x, grid_y) points_to_remap = np.column_stack((grid_x.flatten(), grid_y.flatten())) remapped_points = griddata(pro_all,real_all, points_to_remap, method='nearest') mapx = np.zeros([pro_size[1], pro_size[0]], dtype=float) mapy = np.zeros([pro_size[1], pro_size[0]], dtype=float) for idx, num in enumerate(remapped_points): mapx[idx // pro_size[0]][idx % pro_size[0]] = num[0] mapy[idx // pro_size[0]][idx % pro_size[0]] = num[1] mapx = np.float32(mapx) mapy = np.float32(mapy) return mapx, mapy 我对这个函数有几个问题: 我看您在对齐投影图像平面坐标和投影像素坐标的关系时,总共只使用了15个点(生成了15个Aruco码)来插值计算1280*720个值,经过插值之后结果全为nan,想问一下您是怎么解决的
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>
但是当我使用上述代码时插出来的全是nan,导致因为可用的点不足而报错。
Traceback (most recent call last):
File "test.py", line 100, in
One-to-one matching of projector image plane coordinates and projected image pixel coordinates
def get_martix(pro_all, real_all, pro_size):
Determine how points in the image plane of the projector are projected into the projected image by interpolation
我对这个函数有几个问题: 我看您在对齐投影图像平面坐标和投影像素坐标的关系时,总共只使用了15个点(生成了15个Aruco码)来插值计算1280*720个值,经过插值之后结果全为nan,想问一下您是怎么解决的