diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0604a76..62a7aa3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-ast - id: trailing-whitespace @@ -13,11 +13,11 @@ repos: - id: mixed-line-ending - id: check-added-large-files - repo: https://github.com/psf/black - rev: 24.3.0 + rev: 24.4.2 hooks: - id: black - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.39.0 + rev: v0.41.0 hooks: - id: markdownlint - repo: https://github.com/pycqa/flake8 diff --git a/stitching/feature_detector.py b/stitching/feature_detector.py index 6b77ee4..9cf7112 100644 --- a/stitching/feature_detector.py +++ b/stitching/feature_detector.py @@ -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 diff --git a/stitching/verbose.py b/stitching/verbose.py index 03123d0..6982972 100644 --- a/stitching/verbose.py +++ b/stitching/verbose.py @@ -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 @@ -42,7 +42,9 @@ 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 @@ -90,7 +92,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") @@ -99,7 +101,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 @@ -135,7 +137,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 @@ -151,7 +153,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 @@ -166,7 +168,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