How can i make Interactive Floor Projection in openframework?


#21

Hi Hennio,

Now I have made all code but I am stuck in little confusion.What I done is,

I have make multiple replica of my leaf image and on that background i have put my camera.

Which are find blob on my live feed and give me that blob centroid position.But how can I do,

my “ofApp.cpp” file code value ( position of blob centroid x and y ) are pass to the my another “demoparticle.cpp” file code which are show below.

demoparticle.cpp

ofPoint attractPt(ofGetMouseX(), ofGetMouseY());
frc = attractPt-pos;

	//let get the distance and only repel points close to the mouse
	float dist = frc.length();
	frc.normalize(); 
	
	vel *= drag; 
	if( dist < 150 ){
		vel += -frc * 0.6; //notice the frc is negative 
	}else{
		//if the particles are not close to us, lets add a little bit of random movement using noise. this is where uniqueVal comes in handy. 			
		frc.x = ofSignedNoise(uniqueVal, pos.y * 0.01, ofGetElapsedTimef()*0.2);
		frc.y = ofSignedNoise(uniqueVal, pos.x * 0.01, ofGetElapsedTimef()*0.2);
		vel += frc * 0.04;
	}

Please guide me here.

Thanks.


#22

Gives you the mouse point.

You should change this point to your blob coordinates


#23

Hi Hennio,

Thanks for help,

I have complete this code but my frame rate is very low when I create more then 150 leaf image replicate particle.On running time its give me 7-8 frame rate for 300 particle. So its possible to increase frame rate for more particle ( leaf ).

Regards.


#24

You will have to look into parallelizing your code.

CPU Threads: You can follow this other pos: Threading for n00bs
GPU OpenCL: OpenCL particles morphing to face image


#25

Hi Hennio,

I have read above link but don’t understand what it’s properly meaning.

I have debugging, where I found when I draw ofCircle so its working great but when I use leaf image, create
particle and run application its slow down my framerate to 4-5 fps.


#26

Hi Hennio,

Thanks for your help.

I am solved my issues for slow down frame rate when create grater then 300 - 400 particle.

Now its worked great.

Regard.


#27

I’m trying to create the same type of project but keep getting stuck as I am pretty new to OpenFrameworks. Would you mind sharing your source code?

Thanks!


#28

Hello @thesmeazy, great you joined to OF community! If you are quite new into this kind of coding I might suggest you to start with OpenCv example ( Examples --> addons --> ofxOpencv ), play with images and FindCountours results, so after this you can have a better idea of what are you need in terms of computer vision. Same with graphics, check about particles examples or another kind of real time graphics that you would like to play and see how you can adapt it for your floor interaction (fake CV with a mouse input). Once you know about all this look how to unify them.


#29

Thanks for the response!

I’ve been playing around with a few Particle examples but I can’t seem to find any documentation on how to create a particle system with custom images like the video below:

In the Heineken example I see that each of the coasters are rotated randomly so they all don’t look the same…is this automatically done by the particle system or is there some rotation code being implemented to create this effect?


#30

I’ve seen particle example with textures billboardRotationExample might work for you to start. This example is located at Examples -> GL -> billboardRotationExample. Less is often more, If you want to ask about that particles and rotation issues, I would suggest you to open a new thread (if does not previously exist) to talk about those particle rotation effects, how to set a different textures, and how is going your progress on it.
Hope that helps


#31

Thank you! This is what I was looking for.

I got the billboardRotationExample working with all the snowflakes showing and moving around the mouse but there are a bunch of snowflakes that are flying around the screen randomly when I start the app. I’m not sure if that’s how the example is supposed to be or maybe it’s some glitch because I am using OpenFrameworks v0.9.8?


#32

I don’t really know about this example, but seems to be like this: It keeps moving some particles near mouse in the direction of the last mouse movement with a kind of angle restriction. You should try to do this code smaller (with less mouse interaction), so start from something enough clear for you. Then if you have more questions or you want to share your progress with this I guess you should start a new thread (this thread a bit old already) in this forum pointing to this thread, talking about your idea, how you want to make it and few questions to start it.