Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasalexanderweber committed Jun 1, 2024
1 parent 9210bed commit 831c957
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions stitching/feature_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def detect_with_masks(self, imgs, masks):
raise StitchingError("image and mask lists must be of same length")
if not np.array_equal(img.shape[:2], mask.shape):
raise StitchingError(
f"Resolution of mask {idx+1} {mask.shape} does not match"
f" the resolution of image {idx+1} {img.shape[:2]}."
f"Resolution of mask {idx + 1} {mask.shape} does not match"
f" the resolution of image {idx + 1} {img.shape[:2]}."
)
features.append(self.detect_features(img, mask=mask))
return features
Expand Down
14 changes: 7 additions & 7 deletions stitching/verbose.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def verbose_stitching(stitcher, images, feature_masks=[], verbose_dir=None):
features = stitcher.find_features(imgs, feature_masks)
for idx, img_features in enumerate(features):
img_with_features = finder.draw_keypoints(imgs[idx], img_features)
write_verbose_result(_dir, f"01_features_img{idx+1}.jpg", img_with_features)
write_verbose_result(_dir, f"01_features_img{idx + 1}.jpg", img_with_features)

# Match Features
matcher = stitcher.matcher
Expand All @@ -42,7 +42,7 @@ def verbose_stitching(stitcher, images, feature_masks=[], verbose_dir=None):
)
)
for idx1, idx2, img in all_relevant_matches:
write_verbose_result(_dir, f"02_matches_img{idx1+1}_to_img{idx2+1}.jpg", img)
write_verbose_result(_dir, f"02_matches_img{idx1 + 1}_to_img{idx2 + 1}.jpg", img)

# Subset
subsetter = stitcher.subsetter
Expand Down Expand Up @@ -90,7 +90,7 @@ def verbose_stitching(stitcher, images, feature_masks=[], verbose_dir=None):
final_corners, final_sizes = warper.warp_rois(final_sizes, cameras, camera_aspect)

for idx, warped_img in enumerate(final_imgs):
write_verbose_result(_dir, f"04_warped_img{idx+1}.jpg", warped_img)
write_verbose_result(_dir, f"04_warped_img{idx + 1}.jpg", warped_img)

# Excursion: Timelapser
timelapser = Timelapser("as_is")
Expand All @@ -99,7 +99,7 @@ def verbose_stitching(stitcher, images, feature_masks=[], verbose_dir=None):
for idx, (img, corner) in enumerate(zip(final_imgs, final_corners)):
timelapser.process_frame(img, corner)
frame = timelapser.get_frame()
write_verbose_result(_dir, f"05_timelapse_img{idx+1}.jpg", frame)
write_verbose_result(_dir, f"05_timelapse_img{idx + 1}.jpg", frame)

# Crop
cropper = stitcher.cropper
Expand Down Expand Up @@ -135,7 +135,7 @@ def verbose_stitching(stitcher, images, feature_masks=[], verbose_dir=None):
for idx, (img, corner) in enumerate(zip(final_imgs, final_corners)):
timelapser.process_frame(img, corner)
frame = timelapser.get_frame()
write_verbose_result(_dir, f"07_timelapse_cropped_img{idx+1}.jpg", frame)
write_verbose_result(_dir, f"07_timelapse_cropped_img{idx + 1}.jpg", frame)

# Seam Masks
seam_finder = stitcher.seam_finder
Expand All @@ -151,7 +151,7 @@ def verbose_stitching(stitcher, images, feature_masks=[], verbose_dir=None):
]

for idx, seam_mask in enumerate(seam_masks_plots):
write_verbose_result(_dir, f"08_seam_mask{idx+1}.jpg", seam_mask)
write_verbose_result(_dir, f"08_seam_mask{idx + 1}.jpg", seam_mask)

# Exposure Error Compensation
compensator = stitcher.compensator
Expand All @@ -166,7 +166,7 @@ def verbose_stitching(stitcher, images, feature_masks=[], verbose_dir=None):
]

for idx, compensated_img in enumerate(compensated_imgs):
write_verbose_result(_dir, f"08_compensated{idx+1}.jpg", compensated_img)
write_verbose_result(_dir, f"08_compensated{idx + 1}.jpg", compensated_img)

# Blending
blender = stitcher.blender
Expand Down

0 comments on commit 831c957

Please sign in to comment.