stitching_detail.py
(comprising feature detection, pairwise image matching, homography estimation, bundle adjustment, waviness correction, image warping, stitching seam estimation and seaming/masking, timelapsing of warped images, blending of warped images) does not provide deep insights into what OpenCV is doing under the hood and what is the result/output of each step.
Remedy is provided here: The stitching pipeline presented here is an enhanced version of stitching_detaily.py
and offers more documentation within the code and a better understanding of each step within the stitching pipeline due to a lot of image output to disk.stitching_detaily.py
(cv.detail_BestOf2NearestMatcher
and cv.detail_BestOf2NearestRangeMatcher
) perform poorly on starry sky images. Therefore a custom bruteforce matcher (leveraging cv.BFMatcher(cv.NORM_HAMMING)
) is introduced here which returns a tuple of cv2.detail.MatchesInfo
objects like cv.detail_BestOf2NearestMatcher
and cv.detail_BestOf2NearestRangeMatcher
also do.For an all sky fisheye panorama starry sky images should be taken according to a plan.
For an 18 mm lens this setup yields good overlap between the images:
OpenCV matchers can match keypoints/descriptors, which are single points on each image:
On starry sky images, especially on images with a low amount of stars and a dark unique background, this can become problematic because »many stars look the same«.
Matching star constellations would be helfpful but OpenCV matchers are not able to match constellations – they are just able to match keypoints/descriptors.
The StarPolygonMatcher presented here provides this functionality:
Star constellations or polygons are compared based on angles, side lengths and star brightnesses.
For a 5-sided polygon like shown above there are 5 vertex angles, 5 side lengths and 5 star brightnesses.
The vertex angles and side lengths are not measured in the image plane! The stars from the image plane are projected to a sphere in the physical real world. Angles and side lengths are then measured on this sphere leveraging spherical trigonometry. The radius of this sphere does not matter since side lengths of spherical triangles are measured in radian.
Drop mistakenly detected stars at the horizon edge.
December 2022
Joachim Broser