2015-11-03 61 views
0

我看在python skimage工具包與表示在2D仿射變換一些代碼,存在被定義爲AffineTransform類:在2D仿射剪切變換

Parameters 
---------- 
matrix : (3, 3) array, optional 
    Homogeneous transformation matrix. 
scale : (sx, sy) as array, list or tuple, optional 
    Scale factors. 
rotation : float, optional 
    Rotation angle in counter-clockwise direction as radians. 
shear : float, optional 
    Shear angle in counter-clockwise direction as radians. 
translation : (tx, ty) as array, list or tuple, optional 
    Translation parameters. 

我注意到剪切只需要一個參數(逆時針剪切角度)。但是,爲什麼這不是兩個參數呢?我可以在x和y方向剪切。這兩個操作如何映射到2D中的一個自由參數?

回答

1

目前在代碼中,我們有,用於變換矩陣:

  [sx * math.cos(rotation), -sy * math.sin(rotation + shear), 0], 
      [sx * math.sin(rotation), sy * math.cos(rotation + shear), 0], 
      [      0,        0, 1] 

我不知道如果這確實是指定剪切最直觀的方式。我開了一個問題:https://github.com/scikit-image/scikit-image/issues/1779

+0

謝謝。我想知道你是否會善意地解釋它背後的代數。 – Luca

+0

我同意這不是表達剪切的最常用方式。隨意打開一個問題。同時,您可以使用更通用的ProjectiveTransform。 –