contourFinder and hit testing

hi everyone, long time listener, first time caller

background: im an as3 dev who knows a bit of java who is starting to dabble in oF and C++

that said, i am running into some issues and would appreciate any help

i just figured out how to use the ofxContourFinder to create an outline of myself from a distance, but now im kind of stuck.

im trying to create a simple version of this:

i have my contour lines and i want to have a single image drawn on the screen with a shape cut out for a person to position their body to move through.

i know how to draw objects but im stuck at how to use the contour lines to check against the color of the image to see if its intersecting, thus, hitting the wall.

its just a silly contest for my tech team at work (as3 and php/.net guys) but everyone is pretty shite at c++ and its our first time we’re playing with oF (but its super sick so i hope to keep learning more)

even simple articles that you’ve might of come across that helped learning the basics of openGL and stuff in relation to oF would be much much appreciated.



just some random ideas:

You could either do the hit test with vectors or pixels. if you do it with vectors, you’d have to load the shape a person has to fit in as an array of points. You could save it as an SVG and maybe use or something similar to retreive the coordinates. Then you could check if all points of the found contour are inside the loaded contour, using something like this:

or you could load the shape as an image and draw your openCV contour into an FBO to retreive its pixels. You can then compare these with the pixels of the loaded image in a for loop.…-processing
Wherever a pixel of the color of the shape matches one of the contour, you have a hit. This might be pretty slow though…

This might be what underdoeg was suggesting, but here is what I would do:

Let’s pretend you have a single-channel image that is the target image and another that is a snapshot of what the person/people are actually doing. For argument, let’s say one is red on black and the other is blue on black. You can lay these images on top of each other. The “accuracy” is how few red and blue pixels you have, or how many purple pixels you have, depending on how you want to look at it.

If you are having trouble with performance, downsample the images before you do this process.

I’m pretty sure the OpenCV addon has methods for combining multiple single channel images into a 3-channel image.

On the “way over-doing it” side, there is also Chamfer Matching, which is a “real” contour matching method:…-ching.html

This is included (but not documented) in OpenCV 2.2

i just wanted to say thanks a ton for the links and general info guys - i been hittin the internet hard and finally have something together that resembles the game :smiley: