Search Unity

Cut out users face and head?

Discussion in 'Editor & General Support' started by dmennenoh, Mar 20, 2020.

  1. dmennenoh

    dmennenoh

    Joined:
    Jul 1, 2015
    Posts:
    379
    I have a picture of a face on a green screen. I can remove the green ok, but then I need to cut out their face and head off the neck. Can the OpenCV for Unity plugin do this? I have only seen examples of it doing recognition and showing a rect where the face is. I need the chin outline though. Would DLib be a good choice?
     
  2. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    If you have an isolated subject on a green background, you could probably write a compute shader that gets that area and writes it to another texture?

    Just a simple high level idea: pass in the source frame. Then find out the bounds of the object by analysing the image pixels. Then center your selection to that area and copy the contents to a target power of two texture (like 512x512), and you got your head extracted.
     
  3. dmennenoh

    dmennenoh

    Joined:
    Jul 1, 2015
    Posts:
    379
    Sorry, maybe I didn't explain very good.

    Using something like DLib I can get landmark points. Using those I think I can construct a mask - the dark area at bottom and isolate the head. I was wondering if OpenCV for Unity could possibly do this as well.
    Thanks for the suggestion.