Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyframeSelection: Add support for masks #1518

Merged
merged 5 commits into from
Aug 28, 2023
Merged

Conversation

cbentejac
Copy link
Contributor

@cbentejac cbentejac commented Aug 25, 2023

Description

This PR adds the support of masks to the smart keyframe selection method. When a mask folder is provided, and if these masks correspond to the input sequence(s) (identical number and size of frames), the masks are loaded alongside the frames and are applied during the score computation.

For the sharpness score, the mask is applied on the integral and squared integral images. If the mask covers 50% of the window that is currently evaluated, said window is skipped. This is to avoid having artificially high sharpness scores that are based on a very limited (and mainly masked) region of the image.

For the optical flow score, the mask is also applied on the 2-channel integral image, and similarly, if the mask covers 50% of the currently evaluated cell or more, it is skipped and not added to the vector of cells from which the final score is computed.

Multi-threading, which has been enabed in #1512, also works when masks are provided. If no mask folder is provided, the computation of scores runs as usual.

This relates to alicevision/Meshroom#2167.

Features list

  • Add new parameter to provide mask folders;
  • Load masks alongside the input frames when they have been provided;
  • Apply masks (when available) during the sharpness score computation;
  • Apply masks (when available) during the optical flow computation.

@cbentejac cbentejac added this to the 3.2.0 milestone Aug 25, 2023
@cbentejac cbentejac self-assigned this Aug 25, 2023
@cbentejac cbentejac force-pushed the dev/keyframeMaskSupport branch 2 times, most recently from 82cc4ad to ee4b447 Compare August 25, 2023 14:57
A list of paths to directories containing masks to apply during the
computation of the scores can now be provided as an input.

If a camera rig is being used and masks are provided, then the number of
directories containing masks must be the same as the number of media
paths.
@cbentejac cbentejac force-pushed the dev/keyframeMaskSupport branch 2 times, most recently from f680245 to c3a53da Compare August 25, 2023 15:16
If masks are provided and correspond to the input frames (same number of
frames and masks), load them along the frames.

They are so far not used in the score computations.
If masks have been provided and have passed all the checks (size of the
masks, number of masks, non-emptiness), apply them to the input frames
before the sharpness score is computed.

If a mask covers at least 50% of an evaluated window, it is ignored
and we go on to sliding the window.
The optical flow is computed, and the mask is then applied on the
integral of the motion vectors. The summed motion values will then be
equal to 0 wherever the mask is applied.

When computing the norm of the cell, if we detect that at least 50% of the
cell is masked (by counting the number of 0s within the cell)
@cbentejac cbentejac force-pushed the dev/keyframeMaskSupport branch from c3a53da to 583ed52 Compare August 25, 2023 15:34
@cbentejac cbentejac marked this pull request as ready for review August 25, 2023 15:35
@mugulmd mugulmd merged commit c1ae830 into develop Aug 28, 2023
@mugulmd mugulmd deleted the dev/keyframeMaskSupport branch August 28, 2023 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants