本文整理汇总了Python中cv2.SVDecomp方法的典型用法代码示例。如果您正苦于以下问题:Python cv2.SVDecomp方法的具体用法?Python cv2.SVDecomp怎么用?Python cv2.SVDecomp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cv2
的用法示例。
在下文中一共展示了cv2.SVDecomp方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: blob_mean_and_tangent
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import SVDecomp [as 别名]
def blob_mean_and_tangent(contour):
moments = cv2.moments(contour)
area = moments['m00']
mean_x = moments['m10'] / area
mean_y = moments['m01'] / area
moments_matrix = np.array([
[moments['mu20'], moments['mu11']],
[moments['mu11'], moments['mu02']]
]) / area
_, svd_u, _ = cv2.SVDecomp(moments_matrix)
center = np.array([mean_x, mean_y])
tangent = svd_u[:, 0].flatten().copy()
return center, tangent
示例2: draw_gaussain
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import SVDecomp [as 别名]
def draw_gaussain(img, mean, cov, color):
x, y = np.int32(mean)
w, u, vt = cv2.SVDecomp(cov)
ang = np.arctan2(u[1, 0], u[0, 0])*(180/np.pi)
s1, s2 = np.sqrt(w)*3.0
cv2.ellipse(img, (x, y), (s1, s2), ang, 0, 360, color, 1, cv2.LINE_AA)
示例3: mtx2rvec
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import SVDecomp [as 别名]
def mtx2rvec(R):
w, u, vt = cv2.SVDecomp(R - np.eye(3))
p = vt[0] + u[:,0]*w[0] # same as np.dot(R, vt[0])
c = np.dot(vt[0], p)
s = np.dot(vt[1], p)
axis = np.cross(vt[0], vt[1])
return axis * np.arctan2(s, c)
示例4: mtx2rvec
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import SVDecomp [as 别名]
def mtx2rvec(R):
w, u, vt = cv.SVDecomp(R - np.eye(3))
p = vt[0] + u[:,0]*w[0] # same as np.dot(R, vt[0])
c = np.dot(vt[0], p)
s = np.dot(vt[1], p)
axis = np.cross(vt[0], vt[1])
return axis * np.arctan2(s, c)
示例5: draw_gaussain
# 需要导入模块: import cv2 [as 别名]
# 或者: from cv2 import SVDecomp [as 别名]
def draw_gaussain(img, mean, cov, color):
x, y = np.int32(mean)
w, u, vt = cv2.SVDecomp(cov)
ang = np.arctan2(u[1, 0], u[0, 0])*(180/np.pi)
s1, s2 = np.sqrt(w)*3.0
cv2.ellipse(img, (x, y), (s1, s2), ang, 0, 360, color, 1, cv2.CV_AA)