One dimension image alignment, findTransformECC()
I have successfully implemented some sample code to provide image alignment using findTransformECC()
in MOTION_HOMOGRAPHY
mode with warpPerspective()
. This alignment works as it should, however I would like it to only align (shift) the output image in an up/down movement (locking the sideways movement).
I looked at the warp_matrix
variable and hoped that it would consist of four points [x,y]
where each pointed to how a corner should be moved (in which setting one of the elements to zero in all four points would remove one direction of movement).
I was suggested by others to set element (0, 2)
to zero, they thought this might remove horizontal movement. It affected the movement, but not in the way desired (and I can't explain in which way that changed the movement).
When looking at findTransformECC
() there is some explanation of the output matrix, however as my matrix knowledge is limited, I can't figure out how to modify the matrix to lock sideways movement.
This is how the matrix is explained
[input image] translation to [output image]
My question: How can I lock the sideways movement of the resulting output matrix? Or Is another mode, or totally different method (function) better? (findTransformECC() is somewhat CPU intensive).
I have previously written my own code for image alignment in one direction (which moves images over each other and logs where the difference between them was the lowest) but this did not support subpixel interpolation which is desired.
Thanks for any ideas/suggestions.