Video Helper Suite πŸŽ₯πŸ…₯πŸ…—πŸ…’/maskgenerated

Select Masks πŸŽ₯πŸ…₯πŸ…—πŸ…’(SelectMasks)

This node takes a tensor containing multiple masks as input and determines which masks to retain by parsing the index string provided by the user.

Select Masks

mask
MASK
indexes
0
err_if_missing
err_if_empty
VideoHelperSuite

The Select Masks πŸŽ₯πŸ…₯πŸ…—πŸ…’ node receives a tensor containing multiple masks as input and determines which masks to retain by parsing a user-provided index string.

The Select Masks node is a tool used to filter specific masks from a set of MASK data based on specified index values. Its core function is to allow users to precisely select a portion of a mask sequence for subsequent independent processing or analysis.

Node Function

This node receives a tensor containing multiple masks as input and determines which masks to retain by parsing a user-provided index string. The index supports various flexible formats, such as a single number (e.g., "2"), a comma-separated list (e.g., "0,3,5"), or a range expression (e.g., "1:4"), making batch selection and slicing operations very convenient.

Node Parameter Description - Select Masks πŸŽ₯πŸ…₯πŸ…—πŸ…’

Connection Inputs (Inputs)

Parameter NameData TypeRequiredDefault ValueValue Range/OptionsDescription
maskMASKYes--mask (input parameter): Input a tensor sequence containing multiple masks from which the node will filter.

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueValue Range/OptionsDescription
indexesSTRINGYes0-Comma-separated list or colon range format.
err_if_missingBOOLEANYesTrue-err_if_missing (input parameter): When set to True, the node will report an error if a specified index is out of the mask sequence range.
err_if_emptyBOOLEANYesTrue-err_if_empty (input parameter): When set to True, the node will report an error if the filtered result based on the index is empty.

Output

Parameter NameData TypeDescription
MASKMASKMASK (output parameter): Outputs the filtered mask tensor based on the index.

Usage Scenarios

This node is very useful in video processing workflows. For example, after loading a sequence containing multi-frame masks using the "VHS Batch Load Masks" node, you can use this node to extract only the masks of key frames (e.g., frames 0, 15, 30). These selected masks can then be fed into the "Apply Mask to Batch" node for special effects processing on specific video segments.

Notes

Please note that index values are zero-based. If a provided index exceeds the actual range of the input mask sequence, or if the filtered result is empty, the node's behavior will depend on the settings of the err_if_missing and err_if_empty parameters and may throw an error.

The Select Masks πŸŽ₯πŸ…₯πŸ…—πŸ…’ node is from the ComfyUI-VideoHelperSuite node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…