Skip to content

Commit

Permalink
[keyframe] Skip corrupted frames in VideoFeeds when writing SfMData f…
Browse files Browse the repository at this point in the history
…iles

Instead of stopping (and cancelling) the writing of the output SfMData
file whenever a frame cannot be read, we should check whether the feed
is a VideoFeed or not: if it is, then it is possible to encounter missing
or corrupted frames and these cases should be handled by skipping said
missing or corrupted frames; if it is not, then the frames should already
be on disk and there shouldn't be any error when reading them, hence the
`return false` statement.
  • Loading branch information
cbentejac committed Aug 24, 2023
1 parent b883248 commit 081f68e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/aliceVision/keyframe/KeyframeSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -962,8 +962,15 @@ bool KeyframeSelector::writeSfMDataFromSequences(const std::string& mediaPath, d
for (std::size_t i = 0; i < feed.nbFrames(); ++i) {
// Need to read the image to get its size and path
if (!feed.readImage(image, queryIntrinsics, currentImgName, hasIntrinsics)) {
ALICEVISION_LOG_ERROR("Error reading image");
return false;
ALICEVISION_LOG_ERROR("Error reading image.");

// Frames may be seldomly corrupted in the VideoFeeds, but this should not occur with other feeds
if (feed.isVideo()) {
ALICEVISION_LOG_WARNING("Skipping to the next frame.");
continue;
} else {
return false;
}
}

// Create the view
Expand Down

0 comments on commit 081f68e

Please sign in to comment.