Skip to content

Commit 82af555

Browse files
Improve affine stitcher (#20)
1 parent 4d1563a commit 82af555

3 files changed

Lines changed: 7 additions & 11 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# stitching
22

3-
A Python package for fast and robust Image Stitching.
3+
A Python package for fast and robust Image Stitching.
44

55
Based on opencv's [stitching
66
module](https://github.com/opencv/opencv/tree/4.x/modules/stitching)

stitching/cli/stitch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
action="store",
5454
default=500,
5555
help="Number of features to be detected per image. "
56-
"Only used for the detectors \'orb\' and \'sift'\. "
56+
"Only used for the detectors 'orb' and 'sift'. "
5757
"The default is 500.",
5858
type=int,
5959
)

stitching/stitcher.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __init__(self, **kwargs):
4848
self.initialize_stitcher(**kwargs)
4949

5050
def initialize_stitcher(self, **kwargs):
51-
self.settings = Stitcher.DEFAULT_SETTINGS.copy()
51+
self.settings = self.DEFAULT_SETTINGS.copy()
5252
self.validate_kwargs(kwargs)
5353
self.settings.update(kwargs)
5454

@@ -240,10 +240,9 @@ def create_final_panorama(self):
240240
panorama, _ = self.blender.blend()
241241
return panorama
242242

243-
@staticmethod
244-
def validate_kwargs(kwargs):
243+
def validate_kwargs(self, kwargs):
245244
for arg in kwargs:
246-
if arg not in Stitcher.DEFAULT_SETTINGS:
245+
if arg not in self.DEFAULT_SETTINGS:
247246
raise StitchingError("Invalid Argument: " + arg)
248247

249248

@@ -257,8 +256,5 @@ class AffineStitcher(Stitcher):
257256
"compensator": "no",
258257
}
259258

260-
def initialize_stitcher(self, **kwargs):
261-
affine_defaults = AffineStitcher.AFFINE_DEFAULTS.copy()
262-
self.validate_kwargs(kwargs)
263-
affine_defaults.update(kwargs)
264-
super().initialize_stitcher(**affine_defaults)
259+
DEFAULT_SETTINGS = Stitcher.DEFAULT_SETTINGS.copy()
260+
DEFAULT_SETTINGS.update(AFFINE_DEFAULTS)

0 commit comments

Comments
 (0)