image-processing - pytorch 仿射网格 : what is the theta input?

标签 image-processing computer-vision pytorch

尝试使用时 torch.nn.functional.affine_grid ,它需要一个大小为 (N x 3 x 4) 的 theta 仿射矩阵根据 documentation .我认为一般的仿射矩阵是 (N x 4 x 4) . pytorch 中假定的仿射矩阵格式是什么?

3D 旋转仿射输入的示例将是理想的。感谢你的帮助。

最佳答案

您提到的维度适用于 3D 输入的情况,即您希望对输入张量应用 3D 几何变换 x形状b x c x d x h x w .
3D 中点的转换(在 homogeneous coordinates 中表示为 (x, y, z, 1) 中的 4 向量)在一般情况下应该是您指出的 4x4 矩阵。
但是,由于我们限制了齐次坐标,即第四个坐标必须是 1,所以矩阵的第 4 行必须是 (0, 0, 0, 1) (见 this)。
因此,无需对最后一行进行显式编码。

总而言之,由 3x3 旋转 R 组成的 3D 变换和 3d 翻译 t只是 3x4 矩阵:

theta = [R t]

关于image-processing - pytorch 仿射网格 : what is the theta input?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62167113/

相关文章:

actionscript-3 - ActionScript-3 中的图像处理和效果

c++ - 我如何使用 OpenCV 重写这个 warp-affine?

python - 在 Pytorch 上使用 sigmoid 输出进行交叉熵损失

python - Pytorch中Faster-RCNN模型的输入图像大小

python - 为什么每次保存模型时哈希值都会改变?

image - Matlab的bwlabel,regionprops & centroid函数解释

algorithm - 检测文本的颜色

python - 将透视图转换为顶 View

c++ - OpenCV 中的 recoverPose() 函数是左撇子吗?

image - Ridgelet 和 Curvelet 图像处理包