【问题标题】:How to get rotation, translation, shear from a 3x3 Homography matrix in c#如何在 c# 中从 3x3 单应矩阵获取旋转、平移、剪切
【发布时间】:2013-03-14 21:37:28
【问题描述】:

我计算了 3x3 单应矩阵,我需要获得旋转、平移、剪切和缩放以将它们用作 windows8 媒体元素属性中的参数?!

【问题讨论】:

标签: c# windows-8 transformation homography


【解决方案1】:

https://math.stackexchange.com/questions/78137/decomposition-of-a-nonsquare-affine-matrix

def getComponents(normalised_homography):
  '''((translationx, translationy), rotation, (scalex, scaley), shear)'''
  a = normalised_homography[0,0]
  b = normalised_homography[0,1]
  c = normalised_homography[0,2]
  d = normalised_homography[1,0]
  e = normalised_homography[1,1]
  f = normalised_homography[1,2]

  p = math.sqrt(a*a + b*b)
  r = (a*e - b*d)/(p)
  q = (a*d+b*e)/(a*e - b*d)

  translation = (c,f)
  scale = (p,r)
  shear = q
  theta = math.atan2(b,a)

  return (translation, theta, scale, shear)

【讨论】:

  • 为什么你的输入参数中有标准化的单应性 2x3 矩阵?
  • @FäridAlijani 在我的例子中,它是使用 OpenCV (H, mask) = cv2.findHomography(ptsA, ptsB, method=cv2.RANSAC) 计算的单应矩阵(H)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-04-26
  • 1970-01-01
  • 2016-04-06
  • 2012-03-05
  • 2014-06-10
  • 2011-06-17
相关资源
最近更新 更多