Skip to content

Commit

Permalink
Improve affine stitcher (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasalexanderweber committed Aug 9, 2022
1 parent 4d1563a commit 82af555
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# stitching

A Python package for fast and robust Image Stitching.
A Python package for fast and robust Image Stitching.

Based on opencv's [stitching
module](https://github.com/opencv/opencv/tree/4.x/modules/stitching)
Expand Down
2 changes: 1 addition & 1 deletion stitching/cli/stitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
action="store",
default=500,
help="Number of features to be detected per image. "
"Only used for the detectors \'orb\' and \'sift'\. "
"Only used for the detectors 'orb' and 'sift'. "
"The default is 500.",
type=int,
)
Expand Down
14 changes: 5 additions & 9 deletions stitching/stitcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(self, **kwargs):
self.initialize_stitcher(**kwargs)

def initialize_stitcher(self, **kwargs):
self.settings = Stitcher.DEFAULT_SETTINGS.copy()
self.settings = self.DEFAULT_SETTINGS.copy()
self.validate_kwargs(kwargs)
self.settings.update(kwargs)

Expand Down Expand Up @@ -240,10 +240,9 @@ def create_final_panorama(self):
panorama, _ = self.blender.blend()
return panorama

@staticmethod
def validate_kwargs(kwargs):
def validate_kwargs(self, kwargs):
for arg in kwargs:
if arg not in Stitcher.DEFAULT_SETTINGS:
if arg not in self.DEFAULT_SETTINGS:
raise StitchingError("Invalid Argument: " + arg)


Expand All @@ -257,8 +256,5 @@ class AffineStitcher(Stitcher):
"compensator": "no",
}

def initialize_stitcher(self, **kwargs):
affine_defaults = AffineStitcher.AFFINE_DEFAULTS.copy()
self.validate_kwargs(kwargs)
affine_defaults.update(kwargs)
super().initialize_stitcher(**affine_defaults)
DEFAULT_SETTINGS = Stitcher.DEFAULT_SETTINGS.copy()
DEFAULT_SETTINGS.update(AFFINE_DEFAULTS)

0 comments on commit 82af555

Please sign in to comment.