简体   繁体   English

MatLab和Octave函数cp2tform之间的区别

[英]Difference between MatLab and Octave function cp2tform

I have a function cp2tform in MatLab. 我在MatLab中有一个函数cp2tform I presume that a function cp2tform in Octave, is supposed to give the same output as the one in MatLab. 我假设Octave中的cp2tform函数应该提供与MatLab中相同的输出。

The problem is that in some cases the outputs are different. 问题是,在某些情况下,输出是不同的。


Example: 例:

MatLab Code: MatLab代码:

A = [1,5; 8,7; 10,15];
B = [0,7; 0,4; 0,5];
cp2tform(A,B,'nonreflective similarity')

Output: 输出:

  -0.148848198464265  -0.305965741287655                   0
   0.305965741287655  -0.148848198464265                   0
  -1.810986414648551   8.610750147666863   1.000000000000000

Octave code: 倍频代码:

A = [1,5; 8,7; 10,15];
B = [0,7; 0,4; 0,5];
cp2tform(A,B,"nonreflective similarity")

Output: 输出:

-0.05960  -0.12252   0.00000
 0.12252  -0.05960   0.00000
-0.72517   6.64570   1.00000

My question 我的问题

What am I doing wrong? 我究竟做错了什么?

That is because you can not describe the transformation between your points using 'nonreflective similarity' . 这是因为您无法使用'nonreflective similarity'描述点之间的转换。

The correct answer is: both MATLAB and OCTAVE are wrong. 正确的答案是:MATLAB和OCTAVE都是错误的。

'nonreflective similarity' , from MATLAB: 来自MATLAB的'nonreflective similarity'

Use this transformation when shapes in the input image are unchanged, but the image is distorted by some combination of translation, rotation, and scaling. 当输入图像中的形状不变但图像因平移,旋转和缩放的某种组合而失真时,请使用此变换。 Straight lines remain straight, and parallel lines are still parallel. 直线保持直线,而平行线仍然平行。

在此处输入图片说明

But if you look at your points: 但是,如果您看一下自己的观点:

在此处输入图片说明

There is no way you can convert a triangle into a line with rotation translation and scaling. 您无法通过旋转平移和缩放将三角形转换为直线。 Therefore, the computation fails. 因此,计算失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM