I don't really know what "mask" and "extract" mean in this context. If you mean arbitrary selection of shapes then I have a couple of ideas how it can be accomplished. For mouse use I know the theory of arbitrary shape selection, but I never can get it quite right, since moving the mouse around the shape is very difficult for me.
Please explain to me how you imagine creating a mask around a human so that you can "extract" him from the background in the command line.