final project ++ Jon with Kyle, Ji Yeon and Elie = Medieval Science Team

the case of the disappearing coin (here's the CODE) :

This was some code we developed for Marco Tempest so he can perform a trick he had planned. The trick was to put a unique coin in a sealed box and have it disappear from the box and reappear outside. From a tech position this is achieved by doing some image capture of the coin before the box is sealed, and then the captured coin image is overlayer onto the video of the glove in the box, until the coin changes size and reappears by magic in a viewer's wallet.

The challenge with the code was to be able to capture the coin image and sandwich it between the different live video images, so it looks like it's really there.

Some turning points... breaking the code out into classes. I'm not a seasoned OOP programmer, but I've used it before, but mostly for modules so as not to repeat code. But creating classes also proved to be a good way to group chunks of code and organize variables that belong together -- kind of like creating groups in Illustrator or Flash.





    Elie's video of control screen



    Elie's video of full screen



    control screen



    full screen (capturing coin)



    top hand + captured coin + bottom hand





What we have:

Well, so it works, a bit crude still, and it could use some more polish, and to date we haven't tried it with a great test video. We have recieved two videos from Marco which have been invaluable, but neither or completely representative of the final video. So when it's live it will need some more work. But at the last minute we added some rudimentary XML loading that will load HSV calibration for the video, though right now we don't have ready to be saved to XML (working on it).

The blocks of code are broken into 3 main classes:
   medievalayer - takes HSV settings to determine a mask
   handDetector - determines a contour to create find the centroid of the hand
   brutalExperiment - uses mask to create a 4 channel (RGBA) texture -- used for sandwiching video layers


To really finish this up we need to test with live video in controlled situation. We also haven't really coded an elegant way to make the captured coin disappear. We have it moving a little, and we experimented with resizing it, but we would need to talk to Marco again to review what we can do with coin effect.

(A note about running the code, you will need to have ofxXMLSettings loaded.)



Instructions:

First, included with the code are two videos + two XML. If the code finds "coin_test.mp4" then it will load that video (a yellow glove on black background). If it doesn't find it, then it will load "coin1.mov" (a black glove on a white background). This is a crude way of controlling which video loads outside the code.

There are a list of controls on the loaded screen which explain the controls and HSV control.

Here's basics:

    '1' and '2' toggles between control screen and full screen.

    ' ' captures coin and stores it

    'x' draws the captured coin image

    'p' pauses

    'r' rewinds to start

    there are HSV controls (a, z, s, x, d, c, f, v, g, b)

    'H' toggle between HSV controls for COIN / HAND