Fix broken loading of image masks on macOS #1639
Merged
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.
OS: macOS 12.5.1
COLMAP version: 3.8
I experienced the problem that my image masks where not used during feature extraction. Debugging of the mask loading process showed that function
GetRelativePath(options_.image_path, image_path)
had a faulty behaviour:This could be related to issues of the BOOST filesystem library with paths with trailing slashs under macOS (probably related boostorg/filesystem#76). The wrong path lead to
ExistsFile(mask_path)
returningFalse
, and therefore to not loading the image mask.As
options_.image_path
is fully contained inimage_path
, the (for macOS) faulty function for computation of relative paths is not needed at all. In fact, the relative path is already computed with simple string operations forimage->Name()
(see line 105).Independent of this problem,
mask_path
was not processed the same way asimage_path
, before being assigned tooptions
. This could have led to issues in the future.