Open ttbek opened 3 years ago
Regarding the errors you get with homography transform:
OpenCV(4.2.0) ../modules/video/src/ecc.cpp:388: error: (-215:Assertion failed) map.rows ==3 in function 'findTransformECC'
This is because on line 43 in task_align.cc
the m_transformation
is initialized to 2x3 matrix, while homography transform uses 3x3 matrix.
By a quick look, this would be the list of things to change to try it out, all in task_align.cc
:
If you try it out and it works well, I would be happy to accept a pull request. The initial code used homography transform simply because I was working on microscope images.
It may also be that in your case some of the images may be failing to align while others do. Using --save-steps
and browsing through the aligned images is easy way to check how well they are aligned.
I'm trying to align some sets of images here that were taken freehand and the results I'm getting are quite bad. On the one hand, obviously using a tripod would improve things. On the other hand, I thought the results would be better than what I'm seeing. I poked around just a tiny bit in the code and see that you use only the Affine transformation. How many other things need to be changed in order to use a Homography tranformation instead? I tried briefly just changing that call and now have the output:
I don't have experience with OpenCV, are they just so poorly aligned that it is failing to find a Homography transform, or is that change breaking something else, maybe finding Homography will return a larger matrix?
Well, I am attaching two result examples. The first had the images taken freehand. For the 2nd, the camera was rested, but that one might be having some issues due to banding from the lighting (it was really bad even though you don't really see it in the output, like a quarter of each image was amber). Had to reduce the size of the second image to make it small enough to upload... but I promise what you're seeing is not jpeg artifacting even though it is at only the 80 quality setting.
I'll shoot with a tripod if that is really what it takes to get decent stacking results. I understand that alignment and focus stacking are hard problems, but I know I've seen a lot of better results than what I'm getting.