Q
Q
qart172016-04-17 14:31:53
Mathematics
qart17, 2016-04-17 14:31:53

Finding the shift of one image relative to another?

Two photographs are given, one was taken from a shifted and rotated angle (the displacement vector and the rotation angle are assumed not to be too large). It is required to find the displacement vector and rotation angles.
The answer for the case when there is no rotation is also interesting.
Which way to look, what to read? Whether it is possible to implement through search of special points on images?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
nirvimel, 2016-04-17
@qart17

I won’t tell you about OpenCV, but I would write it manually. The idea is simple: We set a function that checks the truth (more precisely, its inverse value, such as "falsity") of the hypothesis that the second image is the first image, shifted along the axes exactly by the X, Y values. This function is calculated (for example) as the sum of the squared differences of the values ​​of the corresponding pixels the first image and the second one shifted by -X, -Y. Having such a function, then we simply find its minimum using the gradient descent method (initial values ​​X=0, Y=0), the obtained X, Y will be the calculated offset values ​​​​of the second image from the first.
With rotation, everything is similar, only one more variable is added - the degree of rotation. But the hypothesis testing function becomes much more computationally difficult: at least one trigonometric function will go to each pixel (relatively heavy for the CPU), plus this breaks off the SIMD optimization, which gives a multiple speedup for the first variant without rotation.

A
Alexander Skusnov, 2016-04-18
@AlexSku

Example from MatLab

P
Pavel K, 2016-04-17
@PavelK

In OpenCV there is a phaseCorrelate output to get the offset direction.

D
Dimonchik, 2016-04-17
@dimonchik2013

read this blog
www.pyimagesearch.com/2015/03/16/image-pyramids-wi...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question