here are some experiments focused on smashing / crashing / bashing the holler sydney logo.
made using openframeworks and box2d.
the two interactive demos use openCV for the camera interaction.
1) first step is to work out the frame differencing, basically taking away the last two frames in the camera stream and working out the difference in the image. its a way of allowing the camera to see movement.
2) next step is to work out the common area of intersect between the movement image and the holler logo. by applying the & operator, both images are checked for common areas containing white pixels.
3) contour analysis is then applied on the common area of intersect. it searches out all the white blobs in that image and returns the result as a series of points which when connected show an outline of the blobs and mathematically describe what each blob/shape looks like.
4) now that each white blob is described as a bunch of points, that data can be passed to a delaunay triangulation algorithm which calculates the triangles necessary to fill that shape.
5) finally optical flow is used to add velocity to the box2d elements.
kikko posted ofxTriangle along with his great example on this openframeworks post.
also check out akira‘s awesome box2d demo.
being able to generate a number of triangles from a polygon goes very far with box2d, a physics library for c++ which has been extended into openframeworks. it allows you to create complex shapes that can be part of the physics simulation by using their triangle constituents. box2d is very basic at its core, it supports rectangular boxes, circles and simple convex polygons like triangles, but thats where it stops and if you want to go any further, you have to use these building blocks to create more complex shapes.
i thought it would be a good idea to start doing the experiments with some basic shapes, something i could easily import into openframeworks and since i was doing all this in work downtime i felt just a little obliged to use the agency logo.
one thing openframeworks is a little short on at the moment is svg support, so its not as simple as it should be to import illustrator files and receive a list of points to draw your shapes. instead i had to use contour analysis to work out the shape of the logo from an image. this is all good but the final shapes are not as clean as they could be if imported as straight svg files.
EDIT :: i stay corrected, was pointed to ofxSvgLoader addon and it works beautifully, happy days!
Tags: box2d, openframeworks
[...] the full post on his blog with detail descriptions of each [...]
[...] the full post on his blog with detail descriptions of each [...]