fix 4.x links

This commit is contained in:
Alexander Alekhin
2021-12-22 13:01:26 +00:00
parent be110d0464
commit c78a8dfd2d
134 changed files with 334 additions and 332 deletions
@@ -36,11 +36,11 @@ class Blender:
self.blender.prepare(dst_sz)
def feed(self, img, mask, corner):
"""https://docs.opencv.org/master/d6/d4a/classcv_1_1detail_1_1Blender.html#a64837308bcf4e414a6219beff6cbe37a""" # noqa
"""https://docs.opencv.org/4.x/d6/d4a/classcv_1_1detail_1_1Blender.html#a64837308bcf4e414a6219beff6cbe37a""" # noqa
self.blender.feed(cv.UMat(img.astype(np.int16)), mask, corner)
def blend(self):
"""https://docs.opencv.org/master/d6/d4a/classcv_1_1detail_1_1Blender.html#aa0a91ce0d6046d3a63e0123cbb1b5c00""" # noqa
"""https://docs.opencv.org/4.x/d6/d4a/classcv_1_1detail_1_1Blender.html#aa0a91ce0d6046d3a63e0123cbb1b5c00""" # noqa
result = None
result_mask = None
result, result_mask = self.blender.blend(result, result_mask)
@@ -6,7 +6,7 @@ from .stitching_error import StitchingError
class CameraAdjuster:
"""https://docs.opencv.org/master/d5/d56/classcv_1_1detail_1_1BundleAdjusterBase.html""" # noqa
"""https://docs.opencv.org/4.x/d5/d56/classcv_1_1detail_1_1BundleAdjusterBase.html""" # noqa
CAMERA_ADJUSTER_CHOICES = OrderedDict()
CAMERA_ADJUSTER_CHOICES['ray'] = cv.detail_BundleAdjusterRay
@@ -4,7 +4,7 @@ import numpy as np
class WaveCorrector:
"""https://docs.opencv.org/master/d7/d74/group__stitching__rotation.html#ga83b24d4c3e93584986a56d9e43b9cf7f""" # noqa
"""https://docs.opencv.org/4.x/d7/d74/group__stitching__rotation.html#ga83b24d4c3e93584986a56d9e43b9cf7f""" # noqa
WAVE_CORRECT_CHOICES = OrderedDict()
WAVE_CORRECT_CHOICES['horiz'] = cv.detail.WAVE_CORRECT_HORIZ
WAVE_CORRECT_CHOICES['vert'] = cv.detail.WAVE_CORRECT_VERT
@@ -32,9 +32,9 @@ class ExposureErrorCompensator:
)
def feed(self, *args):
"""https://docs.opencv.org/master/d2/d37/classcv_1_1detail_1_1ExposureCompensator.html#ae6b0cc69a7bc53818ddea53eddb6bdba""" # noqa
"""https://docs.opencv.org/4.x/d2/d37/classcv_1_1detail_1_1ExposureCompensator.html#ae6b0cc69a7bc53818ddea53eddb6bdba""" # noqa
self.compensator.feed(*args)
def apply(self, *args):
"""https://docs.opencv.org/master/d2/d37/classcv_1_1detail_1_1ExposureCompensator.html#a473eaf1e585804c08d77c91e004f93aa""" # noqa
"""https://docs.opencv.org/4.x/d2/d37/classcv_1_1detail_1_1ExposureCompensator.html#a473eaf1e585804c08d77c91e004f93aa""" # noqa
return self.compensator.apply(*args)
@@ -15,13 +15,13 @@ class FeatureMatcher:
**kwargs):
if matcher_type == "affine":
"""https://docs.opencv.org/master/d3/dda/classcv_1_1detail_1_1AffineBestOf2NearestMatcher.html""" # noqa
"""https://docs.opencv.org/4.x/d3/dda/classcv_1_1detail_1_1AffineBestOf2NearestMatcher.html""" # noqa
self.matcher = cv.detail_AffineBestOf2NearestMatcher(**kwargs)
elif range_width == -1:
"""https://docs.opencv.org/master/d4/d26/classcv_1_1detail_1_1BestOf2NearestMatcher.html""" # noqa
"""https://docs.opencv.org/4.x/d4/d26/classcv_1_1detail_1_1BestOf2NearestMatcher.html""" # noqa
self.matcher = cv.detail.BestOf2NearestMatcher_create(**kwargs)
else:
"""https://docs.opencv.org/master/d8/d72/classcv_1_1detail_1_1BestOf2NearestRangeMatcher.html""" # noqa
"""https://docs.opencv.org/4.x/d8/d72/classcv_1_1detail_1_1BestOf2NearestRangeMatcher.html""" # noqa
self.matcher = cv.detail.BestOf2NearestRangeMatcher_create(
range_width, **kwargs
)
@@ -6,7 +6,7 @@ from .blender import Blender
class SeamFinder:
"""https://docs.opencv.org/master/d7/d09/classcv_1_1detail_1_1SeamFinder.html""" # noqa
"""https://docs.opencv.org/4.x/d7/d09/classcv_1_1detail_1_1SeamFinder.html""" # noqa
SEAM_FINDER_CHOICES = OrderedDict()
SEAM_FINDER_CHOICES['dp_color'] = cv.detail_DpSeamFinder('COLOR')
SEAM_FINDER_CHOICES['dp_colorgrad'] = cv.detail_DpSeamFinder('COLOR_GRAD')
@@ -19,7 +19,7 @@ class SeamFinder:
self.finder = SeamFinder.SEAM_FINDER_CHOICES[finder]
def find(self, imgs, corners, masks):
"""https://docs.opencv.org/master/d0/dd5/classcv_1_1detail_1_1DpSeamFinder.html#a7914624907986f7a94dd424209a8a609""" # noqa
"""https://docs.opencv.org/4.x/d0/dd5/classcv_1_1detail_1_1DpSeamFinder.html#a7914624907986f7a94dd424209a8a609""" # noqa
imgs_float = [img.astype(np.float32) for img in imgs]
return self.finder.find(imgs_float, corners, masks)
@@ -1,4 +1,4 @@
https://github.com/opencv/opencv_extra/tree/master/testdata/stitching
https://github.com/opencv/opencv_extra/tree/4.x/testdata/stitching
s1.jpg s2.jpg
boat1.jpg boat2.jpg boat3.jpg boat4.jpg boat5.jpg boat6.jpg
@@ -317,7 +317,7 @@ def main():
sizes = []
blender = None
timelapser = None
# https://github.com/opencv/opencv/blob/master/samples/cpp/stitching_detailed.cpp#L725 ?
# https://github.com/opencv/opencv/blob/4.x/samples/cpp/stitching_detailed.cpp#L725 ?
for idx, name in enumerate(img_names):
full_img = cv.imread(name)
if not is_compose_scale_set:
@@ -26,7 +26,7 @@ class Timelapser:
)
def initialize(self, *args):
"""https://docs.opencv.org/master/dd/dac/classcv_1_1detail_1_1Timelapser.html#aaf0f7c4128009f02473332a0c41f6345""" # noqa
"""https://docs.opencv.org/4.x/dd/dac/classcv_1_1detail_1_1Timelapser.html#aaf0f7c4128009f02473332a0c41f6345""" # noqa
self.timelapser.initialize(*args)
def process_and_save_frame(self, img_name, img, corner):
@@ -55,7 +55,7 @@ class Warper:
def update_scale(self, scale):
if scale is not None and scale != self.scale:
self.warper = cv.PyRotationWarper(self.warper_type, scale) # setScale not working: https://docs.opencv.org/master/d5/d76/classcv_1_1PyRotationWarper.html#a90b000bb75f95294f9b0b6ec9859eb55
self.warper = cv.PyRotationWarper(self.warper_type, scale) # setScale not working: https://docs.opencv.org/4.x/d5/d76/classcv_1_1PyRotationWarper.html#a90b000bb75f95294f9b0b6ec9859eb55
self.scale = scale
@staticmethod