简体   繁体   English

Opencv 2.4.3在python中估计EditTransform

[英]Opencv 2.4.3 estimateRigidTransform in python

This is really a mess for me and I have a hard time trying to solve this. 对我来说这真是一团糟,我很难解决这个问题。 I want to use the method cv2.estimateRigitTransform in Python with numpy arrays but I can't find anywhere an example or something else that explains the format of the src and dst numpy arrays needed. 我想在Python中使用方法cv2.estimateRigitTransform和numpy数组,但我无法找到解释所需src和dst numpy数组格式的示例或其他任何内容。

Could somebody send me a little example of these 2 arrays that will work with this method? 有人可以给我一些这两个数组的例子吗? I have all the data (in 2D of course) but can't find how to shape it in a numpy array. 我有所有数据(当然是2D),但无法找到如何在一个numpy数组中塑造它。

Please help me. 请帮我。 Thank you! 谢谢!

Here's a basic example that tries to align two random sets of 10 points 这是一个尝试对齐两个随机10个点的基本示例

import numpy as np
import cv2
shape = (1, 10, 2) # Needs to be a 3D array
source = np.random.randint(0, 100, shape).astype(np.int)
target = source + np.array([1, 0]).astype(np.int)
transformation = cv2.estimateRigidTransform(source, target, False)

Documentation is here . 文档在这里

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

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