本文整理匯總了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)