本文整理汇总了Python中Geometry.getPointsDistance方法的典型用法代码示例。如果您正苦于以下问题:Python Geometry.getPointsDistance方法的具体用法?Python Geometry.getPointsDistance怎么用?Python Geometry.getPointsDistance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geometry
的用法示例。
在下文中一共展示了Geometry.getPointsDistance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: detectAllVertices
# 需要导入模块: import Geometry [as 别名]
# 或者: from Geometry import getPointsDistance [as 别名]
def detectAllVertices(self, testImg):
# Detecting vertices on the newly constructed board
self.gray = cv2.cvtColor(testImg, cv2.COLOR_BGR2GRAY)
tempVertices = cv2.goodFeaturesToTrack(self.gray, int(self.FINAL_VERTICES_COUNT), 0.01, 10)
tempVertices = np.int0(tempVertices)
newVertices = []
for i in tempVertices:
x, y = i.ravel()
newVertices.append((x, y))
# Matrix to store coordinates of vertices on the board
self.ALL_VERTICES = [[(0, 0) for x in range(self.FACTOR + 2)] for x in range(self.FACTOR + 2)]
# Filling the matrix
self.ALL_VERTICES[0][0] = (self.CORNERS[1])
for i in range(0, self.FACTOR):
for j in range(0, self.FACTOR):
predicted_x = self.ALL_VERTICES[i][j][0] + int(
(self.OUTER_VERTICES[2][self.FACTOR - i][0] - self.OUTER_VERTICES[0][i][0]) / 8)
predicted_y = self.ALL_VERTICES[i][j][1] + int(
(self.OUTER_VERTICES[3][self.FACTOR - i][1] - self.OUTER_VERTICES[1][i][1]) / 8)
minn_dist = self.INT_MAX
for point in newVertices:
this_dist = Geometry.getPointsDistance(point, (predicted_x, self.ALL_VERTICES[i][j][1]))
if this_dist < minn_dist:
self.ALL_VERTICES[i][j + 1] = point
minn_dist = this_dist
minn_dist = self.INT_MAX
for point in newVertices:
this_dist = Geometry.getPointsDistance(point, (self.ALL_VERTICES[i][j][0], predicted_y))
if this_dist < minn_dist:
self.ALL_VERTICES[i + 1][j] = point;
minn_dist = this_dist
self.ALL_VERTICES[self.FACTOR][self.FACTOR] = (self.CORNERS[3])