Skip to content

Commit

Permalink
make all too long errors and warnings one liner. Need to think about …
Browse files Browse the repository at this point in the history
…precommit error
  • Loading branch information
lukasalexanderweber committed Oct 13, 2024
1 parent 785e42d commit 324e9cd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 23 deletions.
6 changes: 1 addition & 5 deletions stitching/cropper.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,7 @@ def estimate_largest_interior_rectangle(self, mask):

contours, hierarchy = cv.findContours(mask, cv.RETR_TREE, cv.CHAIN_APPROX_NONE)
if not hierarchy.shape == (1, 1, 4) or not np.all(hierarchy == -1):
raise StitchingError(
"""Invalid Contour. Run with --no-crop (using the stitch interface),
crop=false (using the stitcher class) or Cropper(False)
(using the cropper class)"""
)
raise StitchingError("Invalid Contour. Run with --no-crop (using the stitch interface), crop=false (using the stitcher class) or Cropper(False) (using the cropper class)")
contour = contours[0][:, 0, :]

lir = largestinteriorrectangle.lir(mask > 0, contour)
Expand Down
3 changes: 1 addition & 2 deletions stitching/seam_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ def blend_seam_masks(
def colored_img_generator(sizes, colors):
if len(sizes) + 1 > len(colors):
warnings.warn(
"""Without additional colors,
there will be seam masks with identical colors""",
"Without additional colors, there will be seam masks with identical colors",
StitchingWarning,
)

Expand Down
5 changes: 1 addition & 4 deletions stitching/stitcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,7 @@ class AffineStitcher(Stitcher):
def initialize_stitcher(self, **kwargs):
for key, value in kwargs.items():
if key in self.AFFINE_DEFAULTS and value != self.AFFINE_DEFAULTS[key]:
warnings.warn(
f"""You are overwriting an affine default ({key}=
{self.AFFINE_DEFAULTS[key]}) with another value ({value}). Make
sure this is intended""",
warnings.warn(f"You are overwriting an affine default ({key}={self.AFFINE_DEFAULTS[key]}) with another value ({value}). Make sure this is intended",
StitchingWarning,
)
super().initialize_stitcher(**kwargs)
14 changes: 2 additions & 12 deletions stitching/subsetter.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ def subset(self, img_names, features, matches):

if len(indices) < len(img_names):
warnings.warn(
"""Not all images are included in the final panorama.
If this is not intended, use the 'matches_graph_dot_file'
parameter to analyze your matches. You might want to
lower the 'confidence_threshold' or try another 'detector'
to include all your images.""",
"Not all images are included in the final panorama. If this is not intended, use the 'matches_graph_dot_file' parameter to analyze your matches. You might want to lower the 'confidence_threshold' or try another 'detector' to include all your images.",
StitchingWarning,
)

Expand Down Expand Up @@ -65,13 +61,7 @@ def get_indices_to_keep(self, features, pairwise_matches):
indices = indices.flatten()

if len(indices) < 2:
raise StitchingError(
"""No match exceeds the given confidence threshold.
Do your images have enough overlap and common
features? If yes, you might want to lower the
'confidence_threshold' or try another
'detector'."""
)
raise StitchingError("No match exceeds the given confidence threshold. Do your images have enough overlap and common features? If yes, you might want to lower the 'confidence_threshold' or try another 'detector'.")

return indices

Expand Down

0 comments on commit 324e9cd

Please sign in to comment.