Allow png mask without double extension #3284
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
By default, COLMAP searches for mask files by appending ".png" to the image filename. However, this can lead to unexpected behavior when the original image already has a ".png" extension. For example, an image named "image0001.png" would require a mask named "image0001.png.png", which is unintuitive and may cause compatibility issues with other tools that rely on masks, potentially requiring duplicate files.
This patch retains the current behavior as the primary lookup method but introduces a fallback: if the image already has a .png extension and the initial mask file is not found, it also checks for a mask with the exact same name. Since COLMAP allows specifying separate directories for images and masks, having identical filenames is not problematic.
Thank you for considering this patch.