Skip to main content
Participant
April 7, 2023
Question

Variable mask expansion

  • April 7, 2023
  • 1 reply
  • 200 views

Good day,

I've been tracking faces through the clip and will be using these masks further with some expansion. But the size of mask (as the size of face) is variable. It would be great to set the expansion as some percentago of mask size, maybe width. Is there any idea to make an expression for mask expansion to make it variable this way?

Many thanx!

This topic has been closed for replies.

1 reply

Mylenium
Legend
April 7, 2023

The simplest method would probably be to comb through the mask points in a for() loop and find the min/ max values to calculate the bounding boxes and then filter the mask expansion through a linear() expression to correlate it to the mask size. If the mask is reasonably round this should be enough. If the shapes have larger variations one would probably need to calculate the are or fiddle with the tangents and normals to account for different shapes.

 

Mylenium