【发布时间】:2019-01-20 11:24:14
【问题描述】:
我正在尝试从给定图像中找到鸟瞰图。我还具有将其转换为鸟瞰平面所需的旋转和平移(也是固有矩阵)。我的目标是找到一个逆单应矩阵(3x3)。
rotation_x = np.asarray([[1,0,0,0],
[0,np.cos(R_x),-np.sin(R_x),0],
[0,np.sin(R_x),np.cos(R_x),0],
[0,0,0,1]],np.float32)
translation = np.asarray([[1, 0, 0, 0],
[0, 1, 0, 0 ],
[0, 0, 1, -t_y/(dp_y * np.sin(R_x))],
[0, 0, 0, 1]],np.float32)
intrinsic = np.asarray([[s_x * f / (dp_x ),0, 0, 0],
[0, 1 * f / (dp_y ) ,0, 0 ],
[0,0,1,0]],np.float32)
#The Projection matrix to convert the image coordinates to 3-D domain from (x,y,1) to (x,y,0,1); Not sure if this is the right approach
projection = np.asarray([[1, 0, 0],
[0, 1, 0],
[0, 0, 0],
[0, 0, 1]], np.float32)
homography_matrix = intrinsic @ translation @ rotation @ projection
inv = cv2.warpPerspective(source_image, homography_matrix,(w,h),flags = cv2.INTER_CUBIC | cv2.WARP_INVERSE_MAP)
我的问题是,这是正确的方法吗,因为我可以手动设置一个合适的ty,rx,但不适用于提供的(ty,rx)。
【问题讨论】:
标签: opencv computer-vision projection homography