MAX Assignment 4: Impostor

Task: Superimposing a facial image of another person on your face on camera

  1. Detection of the face using the camera & drawing out its perimeters (sensing)
  2. Placing another face, upload a facial .jpg with black background
  3. Blending the image onto the detected face and follow it, soften its edges (effecting)

First part:
The detection of the face and calculating its perimeters is similar to what we’ve been doing for the previous exercises. (jit.grab + cv.jit.faces)

Second part:
Import your cropped image (just the face with black background) using either ‘read’ or ‘importmovie’. Remember to bang it when you run the patch.

Third part:
Define the position of the imported image, by using destination dimensions on the jit.matrix. The attributes ‘@dstdimstart’ and ‘@dstdimend’ tells the incoming matrix the specific start and end position where it should be. Therefore, this function can be used to match the location of the image to the x and y coordinates of the detected face.

Fourth part:
Blend the image and the detected face together using ‘jit.alphablend @mode 1’. Soften the edges using ‘jit.fastblur@mode 4 @range 3’.


jit.matrix 4 char 320 240 @planemap 1 1 2 3 -> blends only with the red channel because of the ‘1 1’, therefore the blended alpha = red. For black and white images, use ‘1 1 1 1’ because you need to blend all.

jit.alphablend @mode 0 -> displays just the voldemort mask
@mode 1 -> displays both the mask and camera image (use this)

You can switch between colour and b/w version using ‘gswitch2’. However, I think the black and white version blends better and looks more natural as compared to the coloured one!

Video documentation

Leave a Reply