OpenStitching / stitching

A Python package for fast and robust Image Stitching
Apache License 2.0
1.93k stars 148 forks source link

Regarding calculation of Homography matrix #170

Closed Ram-198 closed 8 months ago

Ram-198 commented 8 months ago

Hi,

Currently, i have 2 image (lets say A and B) and i am using SIFT and BestOf2NearestMatcher() for feature detection and matching (And i am planning to use my own feature matching method in the future my school project, i need help for H matrix estimation similar to OpenCV).

the output _pairwise_matches_ in file feature_matcher.py (code snippet below)

pairwise_matches = self.matcher.apply2(features, *args, **kwargs)

pairwisematches is of size 4 with datatype detail_MatchesInfo_ where, index [1] and [2] contains valid H matrix for image A & B respectively.

So, could any one please provide more details on how exactly homography [2] is generated??

i think following is the high level flow of BestOf2NearestMatcher (but i want to know more details on Homography is estimated for image B)

_BestOf2NearestMatcher::match() - CpuMatcher::operator()
- CpuMatcher::match()
- FlannBasedMatcher::knnMatch()
- (Convert the matched points to coordinates whose center is zero)
- findHomography()
- (Check the results and decide whether to press “No” and calculate again)
- findHomography() (executed only in inliers)_

in particular, how matches between image B and A are extracted and how its used for estimating the Homography matrix .??

Thank you in advance.

lukasalexanderweber commented 8 months ago

You can search for the code how the matrix is calculated within https://github.com/opencv/opencv/