latsic/imgalign

preventing poor match - questions

Eisenh opened this issue · 1 comments

Great app! I have a question around how to set params.

  1. I understand that Matcher tries to accommodate distortions, but only some distortions are realistic. If the second image is low res, or the target is small, the algorithm returns a very distorted aligned image, when a simple rotated and scaled image would be a better fit. Is there a param setting that would prevent matches from returning a distorted image? Maybe a limit on the transform matrix? Or a switch to return "0" for success when the transform is deemed unlikely (as per the verbose logging)?

This app looks for a perspective transform with the help of https://docs.opencv.org/master/d9/d0c/group__calib3d.html#ga4abc2ece9fab9398f2e560d53c8c9780
What you have in mind is probably some affine transformation. This is not an option in this app, but could probably easily be added by using this
https://docs.opencv.org/4.0.0/d9/d0c/group__calib3d.html#gad767faff73e9cbd8b9d92b955b50062d

Otherwise you can try different settings, for example lowering the max/min match count.
MatchCounMin20Max50
defauSettings

The first Image has default settings for match counts, while the second, which produces a good match, has those settings lowered to 20/50.