Restrict luma/chroma key to contiguous pixels

antialias's icon

I'm trying to sort how to make masks that would be restricted to contiguous areas a la photoshop's magic wand tool. Can't see a way to do this with standard jitter objects or cv.jit— perhaps there's a gen solution? Feathering edges would be a bonus! Any pointers appreciated.

antialias's icon

I'm wondering how this would work:

— define an arbitary submatrix
— find pixels within a luma range in the submatrix
— test to see if any of those pixels touch the border of the submatrix
— if so make the submatrix bigger
— repeat until no pixels touch the border

Seems like there must be an easier way...