本文整理了Java中org.opencv.imgproc.Imgproc.cornerSubPix()
方法的一些代码示例,展示了Imgproc.cornerSubPix()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Imgproc.cornerSubPix()
方法的具体详情如下:
包路径:org.opencv.imgproc.Imgproc
类名称:Imgproc
方法名:cornerSubPix
[英]Refines the corner locations.
The function iterates to find the sub-pixel accurate location of corners or radial saddle points, as shown on the figure below.
Sub-pixel accurate corner locator is based on the observation that every vector from the center q to a point p located within a neighborhood of q is orthogonal to the image gradient at p subject to image and measurement noise. Consider the expression:
epsilon i = (DI(p_i))^T * (q - p_i)
where (DI_(p_i)) is an image gradient at one of the points p_i in a neighborhood of q. The value of q is to be found so that epsilon_i is minimized. A system of equations may be set up with epsilon_i set to zero:
sum i(DI(p_i) * (DI_(p_i))^T) - sum i(DI(p_i) * (DI_(p_i))^T p_i)
where the gradients are summed within a neighborhood ("search window") of q. Calling the first gradient term G and the second gradient term b gives:
q = G^(-1) * b
The algorithm sets the center of the neighborhood window at this new center q and then iterates until the center stays within a set threshold.
[中]细化角点位置。
该函数迭代以查找角点或径向鞍点的亚像素精确位置,如下图所示。
亚像素精确的角点定位器基于这样的观察,即从中心q到位于q邻域内的点p的每个向量与受图像和测量噪声影响的p处的图像梯度正交。考虑表达式:
εi=(DI(p_i))^T(q-p_i)*
其中*(DI_(p_i))是q邻域中的一个点p_i处的图像梯度。要找到q的值,以便最小化epsilon_i*。方程组可设置为epsilon_i为零:
求和-求和-求和-求和-求和-求和
其中梯度在q的邻域(“搜索窗口”)内求和。调用第一个梯度项G和第二个梯度项b给出:
q=G^(-1)b
该算法将邻域窗口的中心设置在这个新的中心q*,然后迭代,直到中心保持在设定的阈值内。
代码示例来源:origin: us.ihmc/IHMCPerception
Imgproc.cornerSubPix(imageGray, corners, new Size(subPixSize, subPixSize), new Size(-1, -1), termCriteria);
代码示例来源:origin: us.ihmc/ihmc-perception
Imgproc.cornerSubPix(imageGray, corners, new Size(subPixSize, subPixSize), new Size(-1, -1), termCriteria);
代码示例来源:origin: openpnp/openpnp
Imgproc.cornerSubPix(matGray, imagePoints, new Size(11, 11), new Size(-1, -1),
new TermCriteria(TermCriteria.EPS + TermCriteria.COUNT, 30, 0.1));
matGray.release();
内容来源于网络,如有侵权,请联系作者删除!