Loading...
Logo
Processing Forum
I have spent the last 2 months trying to figure out how to get an effect like this:

I have run particle emitters and many other interactive things with Processing, but I can't figure out how to attach particles to the dancer's hand or body.  I have a deadline of a couple of weeks to use something similar to the link above for a dance performance.  I am not getting paid to do it, I'm doing it to gain the experience and to also learn to code in Processing.  The problem is I am running out of time and once I understand how to attach particle emitters to dancers in front of a Kinect, I can move on to advance myself further.  I just need to get past this one hurdle.

I do not know how much to pay for a .pde file that will do what is being done in the link above, but I will pay you if I can afford it.

I am using the Kinect for Windows on Windows 7.  I have a projector.

- James

Replies(8)

Hi ZenArtist!

You can take a look to a Kinect sketch I made some months ago:
 http://www.openprocessing.org/sketch/60316

The examples that come with the simple-openni library are very useful too.

And last, but not least, is the Kinect tutorial by amnon.owed:
  http://www.creativeapplications.net/processing/kinect-physics-tutorial-for-processing/

Good luck with the performance!
javier

Hi Javier,

Yes, I am familiar with your sketch and have downloaded it a week ago and played around with what I could, but I still don't understand how to turn the silhouette into particle emitters, or how to attach an emitter to hands, or to have fluid flames or smoke come off the silhouette.

I've also been experimenting with amnon's physics tutorial, but that also doesn't show how to turn the silhouette into a particle system.

This is why I am offering to pay for a .pde doing what I want, because I don't think 2 weeks will be enough time for me to teach myself.  But even after this deadline I will continue to learn and teach myself, so I know I will figure it out eventually.  It's just that I need it by December.

And thank you for your reply!

- James
Ah, now I remember your comment!

This would be my approach. Use simpleopenni to get the blob of the person (example2 in amnon.owed). Use the points from the polygon as source points for your particle system. Save the polygons from several frames to continue using them as source points during some frames (as I do in my sketch for the sand effect).


Another (maybe faster) trick to get the points from the contour:
 - Use example1 by amnon.owed to get the a colored figure.
 - Use the obtainLimits() function from this sketch:
   http://www.openprocessing.org/sketch/59630



Thank you Javier,  I will look at your sand effect and see if I can work with it to get what I am hoping for.  

- James
Hi James,

As you seemed very desperate, I decided to help you a little bit more :)

You can use the code bellow to get the contour limits. Use the array limits[] to position your particles and you are
almost done!

As a payment you have to film the performance, upload it to youtube and send us the link! ;)

Cheers,
javier
 

Copy code
  1. import SimpleOpenNI.*;
  2. SimpleOpenNI  context;
  3. ArrayList limitsList = new ArrayList();

  4. void setup()
  5. {
  6.   context = new SimpleOpenNI(this);
  7.   context.enableScene();

  8.   size(context.sceneWidth(),context.sceneHeight()); 
  9. }


  10. void draw()
  11. {
  12.   context.update(); 
  13.    
  14.   PImage sceneImg = context.sceneImage();
  15.     
  16.   limitsList.add(obtainLimits(sceneImg,color(0)));
  17.   if(limitsList.size() > 10){
  18.    limitsList.remove(0);
  19.   }

  20.   background(150);
  21.   for(int i = 0; i < limitsList.size(); i++){
  22.     PVector[] limits = (PVector[]) limitsList.get(i);
  23.     stroke(color(25*i,0,0));
  24.     for(int j = 0; j < limits.length; j++){
  25.       point(limits[j].x,limits[j].y);
  26.     }
  27.   }
  28. }


  29. PVector[] obtainLimits(PImage img, color bgCol){
  30.   img.loadPixels();

  31.   ArrayList leftRightLimits = new ArrayList();
  32.   ArrayList upDownLimits = new ArrayList();
  33.   
  34.   for(int y = 0; y < img.height; y++){
  35.     color prevCol = bgCol;
  36.     for(int x = 0; x < img.width; x++){
  37.       color col = img.pixels[x + y*img.width];
  38.       if(col != prevCol){
  39.         if(col != bgCol){
  40.           leftRightLimits.add(new PVector(float(x),float(y)));
  41.         }
  42.         else{
  43.           leftRightLimits.add(new PVector(float(x-1),float(y)));
  44.         }
  45.       }
  46.       prevCol = col;
  47.     }
  48.   }

  49.   for(int x = 0; x < img.width; x++){
  50.     color prevCol = bgCol;
  51.     for (int y = 0; y < img.height; y++){
  52.       color col = img.pixels[x + y*img.width];
  53.       if(col != prevCol){
  54.         if(col != bgCol){
  55.           upDownLimits.add(new PVector(float(x),float(y)));
  56.         }
  57.         else{
  58.           upDownLimits.add(new PVector(float(x),float(y-1)));
  59.         }
  60.       }
  61.       prevCol = col;
  62.     }
  63.   }

  64.   ArrayList combinedLimits = new ArrayList();

  65.   for(int i = 0; i < leftRightLimits.size(); i++){
  66.     boolean repeated = false;
  67.     PVector l1 = (PVector) leftRightLimits.get(i);
  68.     for(int j = 0; j < combinedLimits.size(); j++){
  69.       PVector l2 = (PVector) combinedLimits.get(j);
  70.       if(l1.dist(l2) == 0){
  71.         repeated = true;
  72.       }
  73.     }
  74.     if(!repeated){
  75.       combinedLimits.add(l1);
  76.     }
  77.   }  

  78.   for(int i = 0; i < upDownLimits.size(); i++){
  79.     boolean repeated = false;
  80.     PVector l1 = (PVector) upDownLimits.get(i);
  81.     for(int j = 0; j < combinedLimits.size(); j++){
  82.       PVector l2 = (PVector) combinedLimits.get(j);
  83.       if(l1.dist(l2) == 0){
  84.         repeated = true;
  85.       }
  86.     }
  87.     if(!repeated){
  88.       combinedLimits.add(l1);
  89.     }
  90.   }  

  91.   return (PVector[]) combinedLimits.toArray(new PVector[combinedLimits.size()]);
  92. }
Javier, I have only now had the time to start working with your code to see how I can create my own effects.  But, for starters, I am having difficulty getting a full screen with the effect.  It works as is, but its size looks to be around 640x480.  I don't see where in your sketch I can set the screen size to 1366x768.

I have tried using "size(1366,768);" with and without your " size(context.sceneWidth(),context.sceneHeight()); " but it's still not taking up the full screen on my laptop.  Is there any way to do that?

- James
WOW Javier!  Thanks SO much for that sketch!  I'll look more into array limits to try and figure out how to position the particles.  This is a serious crash course for me but I am determined to learn all I can.

- James