Jeep87c
Jeep87c

Reputation: 1120

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.

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.

Please help me. Thank you!

Upvotes: 5

Views: 8218

Answers (1)

Geoff
Geoff

Reputation: 8145

Here's a basic example that tries to align two random sets of 10 points

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.

Upvotes: 4

Related Questions