首页 > 其他分享 >proj_match_points_ransac 算子

proj_match_points_ransac 算子

时间:2022-09-20 18:22:49浏览次数:68  
标签:ransac RandSeed image value 算法 points proj 输入

proj_match_points_ransac(Image1, Image2 : : Rows1, Cols1, Rows2, Cols2, GrayMatchMethod, MaskSize, RowMove, ColMove, RowTolerance, ColTolerance, Rotation, MatchThreshold, EstimationMethod, DistanceThreshold, RandSeed : HomMat2D, Points1, Points2)

Given a set of coordinates of characteristic points (Cols1,Rows1) and (Cols2,Rows2) in both input images Image1 and Image2, proj_match_points_ransac automatically determines corresponding points and the homogeneous projective transformation matrix HomMat2D that best transforms the corresponding points from the different images into each other. The characteristic points can, for example, be extracted with points_foerstner or points_harris.

通过(Cols1、Rows1)和(Cols2和Rows2)里面输入Image1和Image2上的特征点像素坐标集合,proj_match_points_ransac 算子自动获取两点集之间相关点对(相关点的在输入点集的序号在Points1和Points2内输出)和一个等效的投射转换矩阵HomMat2D ,这个矩阵可以以最好的方式将相关点在不同的图片之间相互投射。这些特征点集可以通过 points_foerstner 和 points_harris算子计算得出。

The transformation is determined in two steps: First, gray value correlations of mask windows around the input points in the first and the second image are determined and an initial matching between them is generated using the similarity of the windows in both images.

这个转换矩阵可以通过两个步骤得到:第一,确定了第一幅和第二幅图像输入点周围掩模窗口内的灰度值相关性并且使用两个图像中掩膜窗口内图像的相似性来进行一个初始匹配。

The size of the mask windows is MaskSize x MaskSize. Three metrics for the correlation can be selected. If GrayMatchMethod has the value 'ssd', the sum of the squared gray value differences is used, 'sad' means the sum of absolute differences, and 'ncc' is the normalized cross correlation. For details please refer to binocular_disparity. The metric is minimized ('ssd', 'sad') or maximized ('ncc') over all possible point pairs. A thus found matching is only accepted if the value of the metric is below the value of MatchThreshold ('ssd', 'sad') or above that value ('ncc').

掩膜窗口的大小为输入参数MaskSize的平方。输入参数GrayMatchMethod 提供三种计算相关性的方法。如果GrayMatchMethod 输入为"ssd",则利用窗口内两张图的灰度差异的平方和来评估相似度;如果GrayMatchMethod 输入"sad"表示窗口内两张图的灰度差异的绝对值总和被用来评估相似度。当GrayMatchMethod 输入“ncc”则使用窗口内两张图的归一化互相关性来进行评估相似度,具体细节请参考“binocular_disparity”算子。计算相关性时在所有可能的点对上"ssd" "sad"算法结果值会更小,“ncc”算法结果会更大。因此只有相关性小于MatchThreshold("ssd" "sad")或者大于MatchThreshold("ncc")的点对才会被选中(被选中用来计算转换投射矩阵)。

To increase the algorithm's performance, the search area for the matchings can be limited. Only points within a window of points are considered. The offset of the center of the search window in the second image with respect to the position of the current point in the first image is given by RowMove and ColMove.

为了提高算法表现,上述匹配时的搜素范围i可以被限制。只有在点窗口内的点才会被考虑是否为匹配点。在第二张图中的搜索掩膜窗口的位置是在第一张图上的点的像素位置的基础上进行一个行列的偏移的来的,这个偏移量可以在算子的输入参数RowMove和ColMove中给出。

If the transformation contains a rotation, i.e., if the first image is rotated with respect to the second image, the parameter Rotation may contain an estimate for the rotation angle or an angle interval in radians. A good guess will increase the quality of the gray value matching. If the actual rotation differs too much from the specified estimate the matching will typically fail. The larger the given interval, the slower the operator is since the entire algorithm is run for all relevant angles within the interval.

如果这个转换投射包含旋转,例如第一张图相对于第二张图有一定的旋转,输入参数Rotation可以包含一个提前预估的角度参数或者弧度范围。估计的值越准确,灰度匹配的质量越高。如果实际的旋转和估计的角度差异太大则匹配失败。弧度范围给的越大,算法计算范围内的所有角度,算法运行会更慢。

Once the initial matching is complete, a randomized search algorithm (RANSAC) is used to determine the transformation matrix HomMat2D. It tries to find the matrix that is consistent with a maximum number of correspondences. For a point to be accepted, its distance from the coordinates predicted by the transformation must not exceed the threshold DistanceThreshold.

一旦初次匹配完成以后,一个随机采样算法将会被迎来计算转换矩阵HomMat2D。他将尝试寻找一个吻合相关点对最多的转换矩阵。当投射点和实际点的距离没有超过DistanceThreshold,则表示投射矩阵吻合这对相关点。

Once a choice has been made, the matrix is further optimized using all consistent points. For this optimization, the EstimationMethod can be chosen to either be the slow but mathematically optimal 'gold_standard' method or the faster 'normalized_dlt'. Here, the algorithms of vector_to_proj_hom_mat2d are used.

通过EstimationMethod 参数,我们可以选择一种方法来使用所有的吻合点对转换矩阵进行更进一步的优化。EstimationMethod 可以选择慢而数理最优的算法“gold_standard”也可以选择较快的“normalized_dlt”。这些算法在vector_to_proj_hom_mat2d 中被使用过。

Point pairs that still violate the consistency condition for the final transformation are dropped, the matched points are returned as control values. Points1 contains the indices of the matched input points from the first image, Points2 contains the indices of the corresponding points in the second image.

通过以上的参数设置后输入点集中仍然不满足条件的点会被丢弃,满足的点会被作为输出返回。Points1中包含所有图1中匹配点在图1输入点集中的序号,Points2包含所有图2中匹配点在图2输入点集中的序号。

The parameter RandSeed can be used to control the randomized nature of the RANSAC algorithm, and hence to obtain reproducible results. If RandSeed is set to a positive number, the operator yields the same result on every call with the same parameters because the internally used random number generator is initialized with the seed value. If RandSeed = 0, the random number generator is initialized with the current time. Hence, the results may not be reproducible in this case.

参数RandSeed可以用来控制随机采样算法并因此获得可重新获得的结果。如果RandSeed被设置为一个正值,此算法在每次调用同样参数的情况下产生相同的结果,因为内部使用的随机数生成器被RandSeed的值初始化,只有重新赋值新的RandSeed值,随机值才会变换。如果RandSeed输入值等于0,随机数生成器的值使用当前时间来初始化。因此每次算子执行的结果都不是重复的。

标签:ransac,RandSeed,image,value,算法,points,proj,输入
From: https://www.cnblogs.com/DropInTheSea/p/16711627.html

相关文章