自制数据集的工具 COLMAP 由于作者换方向了,所以如下关于 NERF 的内容待完善
如何使用和怎么下载就不讲了,直接搜就有,它可以把多个拍摄同一物体的图片转换为它们对应视角的相机矩阵和拍摄角度,可以实现自制数据集做 nerf。它的流程(SFM 算法)可以概括如下:
这里主要是记录一下它的原理: 首先是一个经典关键点匹配技术:SIFT
SIFT 特征点匹配
DOG 金字塔
下面是原理方法:
首先是高斯金字塔,它是把原图先放大两倍,然后使用高斯滤波(高斯卷积)对图像进行模糊化数次,取出倒数第三层缩小一半继续进行这个过程,也就是说它是由一组一组的小金字塔组成的。
然后是基于高斯金字塔的 DOG 金字塔,也叫差分金字塔,它是把相邻的高斯金字塔层做减法得到的,因为经过高斯模糊,物体的轮廓(或者说不变特征)被模糊化,也就是被改变。通过相减可以得到这些被改变的点。
空间极值点检测
为了找到变化的最大的几个点来作为特征点,我们需要找到变化的极值点,因此需要进行比较,这里是在整个金字塔中进行对比,我们提取某个点周边 333 的像素点进行比较,找到最大或最小的局部极值点。
同时我们也对关键点分配方向,也就是这个点在图片空间中的梯度方向
梯度为:
梯度方向为:
我们计算以关键点为中心的邻域内所有点的梯度方向,然后把这些 360 度范围内的方向分配到 36 个每个 10 度的方向中,并构建方向直方图,这里的示例使用了 8 个方向,几个随你其实:
取其中最大的为主方向,若有一个方向超过主方向的 80%,那么把它作为辅方向。
操作可以优化为下图,先把关键点周围的像素分成 4 块,每块求一次上面的操作,以这个 4 个梯度直方图作为关键点的方向描述。也就是一个 228 (方向数量) 的矩阵作为这个点的方向特征。
实验表明,使用 448=122 的描述更加可靠。
特征点的匹配是通过计算两组特征点的 128 维的关键点的欧式距离实现的。欧式距离越小,则相似度越高,当欧式距离小于设定的阈值时,可以判定为匹配成功。
以上是 colmap 的第一步,SIFT