opencv estimateRigidTransform:如何获得全局缩放? [英] opencv estimateRigidTransform: How to get global scale?

查看:1054
本文介绍了opencv estimateRigidTransform:如何获得全局缩放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用openCV的estimateRigidTransform来稳定一系列视频帧,效果非常好。

I'm using openCV's estimateRigidTransform to stabilize a series of video frames, which works very well.

该函数返回一个2x3转换矩阵M:

The function returns a 2x3 transformation matrix M:

|  a_11 a_12 b_1 |
| -a_12 a_11 b_2 |

据我所知, b 代表翻译, a 元素用于缩放和旋转。

As far as I understand the b elements represent the translation, and the a elements are used to do the scaling and rotation.

我想要do,是从M获取全局缩放 - 表示相机缩放因子的值。如何从 a 值正确计算?

What I would like to do, is get global scale from M - a value that represents the camera zooming factor. How can I do calculate this correctly from a values?

为了澄清一点我想得到的,这里是一个例子。让我们说estimateRigidTransform计算下面第二帧关于第一帧的变换矩阵M:

To clarify a little more what I want to get, here is an example. Let's say estimateRigidTransform calculates a transformation matrix M for the second frame below regarding to the first frame:

在这种情况下,全局缩放因子应该是aroud 2.我的问题是如何从M? p>

The global zooming factor in this case should be aroud 2. My question is how to get this value from M?

推荐答案

确定,额外搜索后,我发现了一个很好的答案: http://math.stackexchange.com/questions/13150/extracting-rotation-scale-values-from-2d-transformation-matrix

Ok, after additional search I found a great answer here: http://math.stackexchange.com/questions/13150/extracting-rotation-scale-values-from-2d-transformation-matrix

其中缩放由s_x和s_y表示。这两个值大部分是相等的(因为摄像机拍摄的视频在两个方向上都是相等的),所以我可以选择其中一个。

Where the "zooming" is represented by s_x and s_y. These two values will mostly be equal (since zoom in video captured by cameras is equal in both directions), so I can take either one.

这篇关于opencv estimateRigidTransform:如何获得全局缩放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆