I’m using a simple webcam & openCV to detect a contour of people, what is the best way to populate the moving contours with particle systems ? obviously I want the size and shape would determine the amount of particles generated and I want them to die if shape changed and they left outside the contour. I don’t want to populate just the contour but the entire shape.
Any suggestions where to start ? Ideally it should be a simple 2d particle system, nothing to fancy, just not sure where is the best place to start.
I think you can try using ofxCV, and look in the examples folder, especially the particules one i think, as a start.
Hope this helps,
Hi @pierre_tardif00 , while the particles example are definitely a good starting point I can only figure out how to attract the particles to the path of the contour - which isn’t what i’m looking for - I want to emit particles inside the contour , somewhat like this : https://vimeo.com/12648375 but instead of using png images I want to use live camera.
any thoughts ?
ideally I’d use box2d just like in the video - as I’m using in anyways for other parts of the interaction.
post some code, it will help.
I would try to solve it by using 2 different technics :
- checking if I’m inside the contour,
- only emit if I’m inside the contour.
- check - for each particle - that it is inside the contour, if on edge case, a) invert the speed / axceleration, or b) make the particle invisible.
Step 3 is intensive, I’d recommend doing it for 50 particles, then once working properlly, put it into a shader, otherwise computing power will be sucked off…
Maybe if you have the particles already attracted to the path of the contour, try making the position which attracts the points change throughout the array of particle, therefore:
particle 0 will be attracted to contour point 0,
particle 1 will be attracted to contour point 1,
Then increase the attraction point every so and so - like half a second - , such as : the array becomes :
particle 0 will be attracted to contour point 0 + offset,
particle 1 will be attracted to contour point 1 + offset,
With offset being a number significantly big enough so the particules move enough from one point on the contour to an other.
// offset must be modulo length of the contour.
This second technic will use less computing power, which is good, but also you will end up with points passing outside your contour - going from the arm to the head for example-.
Hope this helps,
@pierre_tardif00 thanks again ! plenty of things to think and try. I assumed step 3 won’t be the best most efficient way to go and i’m not to experienced with shaders so it never crossed my mind maybe trying it with a shader actually.
Going to do some homework and I’ll post back once I’ll get stuck or alternatively succeed