Here is a simple implementation of the Superformula(http://en.wikipedia.org/wiki/Superformula) inside Openframeworks, feel free to play around and modify.
Superformula 3d
December 8th, 2013OpenGL Instancing inside Openframeworks
September 28th, 2013Here is a short example on how to implement OpenGL Instancing with GLSL
Simple Shape Matching with kNearest and OpenCV
May 27th, 2013Here is a short demo of how to do a simple shape matching using the “K Nearest Neighbors” algorithm implementation that comes with OpenCV 2.4.
The process of recognition is very simple, first you need to convert some shapes to a sets of points. Then you must train and label the kNearest class with the point sets. Then you could draw some points to the screen and use the find_nearest() function to see which label does the drawn point set will match best.
Here are some code snippets for every task above:
Convert image to a point set
vector<cv::Point> points; ofImage im; im.loadImage("shape.jpg"); cv::Mat original; original = ofxCv::toCv(im).clone(); // 1-channel convert if(original.channels() == 3) { cv::cvtColor(original, original, CV_RGB2GRAY); } else if(original.channels() == 4) { cv::cvtColor(original, original, CV_RGBA2GRAY); } cv::Canny(original, original, 0, 100.0); cv::Mat dilateKernel(cv::Size(3,3), CV_8UC1, cv::Scalar(1)); cv::dilate(original, original, dilateKernel); vector<vector<cv::Point> > foundc; cv::findContours(original, foundc,CV_RETR_EXTERNAL, CV_CHAIN_APPROX_NONE, cv::Point(0,0)); if(foundc.size() >0) { points = foundc[0]; }
Training kNearest
cv::KNearest *knn; cv::Mat trainingData(points.size(), 2, CV_32FC1); cv::Mat trainingClasses(points.size(), 1, CV_32FC1); // we fill the training data with the points set // if we have couple of shapes, we must fill all points into one trainingData set // and label accordingly for(int i=0;i<points.size();i++) { trainingData.at<float>(i,0) = points[i].x; trainingData.at<float>(i,1) = points[i].y; trainingClasses.at<float>(i,0) = 1; // we label the shape as "1", the next added shape point set should be labeled as "2" and etc. } // train the algorithm knn = new kNearest(trainingData, trainingClasses);
Find Matches
// points that are drawn on screen vector<cv::Point> drawnPoints; cv::Mat testData(drawnPoints.size(),2,CV_32FC1); for(int i=0;i<drawnPoints.size();i++) { testData.at<float>(i,0) = drawnPoints[i].x; testData.at<float>(i,0) = drawnPoints[i].y; } // found will return the label that is closer to the drawn points int found = knn->find_nearest(testData,1);
You could check out a working example at: https://github.com/kamend/kNN_ShapeMatch
Digital Merzbau
April 30th, 2013Recently I stumbled upon this article http://www.gooood.hk/_d273178665.htm, which is about a simple proceses of generating complex forms from primitives. I couldn’t find any information, beside the instructions, so I decided to make my own implementation inside Openframeworks. The program takes OBJ files as input, then you could divide, extrude or intrude all mesh polygons and at the end save the mesh as an OBJ for importing and rendering in your favourite 3D program (Cinema 4d in my case). I plan to release the code and the program as binary as soon, as clean it up a little bit.
Here are some test renders:
And just a demo of the program:
You could follow all my experiments at: http://kamend.tumblr.com or http://pinterest.com/dimitroff/
My favorite Wolfram CA rulesets
April 17th, 2013After watching Daniel Shiffman’s great video lecture about Wolfram’s Cellular Automata (this is plural for Cellular Automaton), I got inspired to try all rulesets one by one and see the results. Here are screenshots of my favorite ones:
Kinect Delaunay
April 9th, 2013Some fun with Delaunay Triangulation and Kinect 3D Meshes. I really love that pencil drawn like look of the images.
Kinect Delaunay from Kamen Dimitrov on Vimeo.
For the curious, here is the Openframeworks project on GitHub: https://github.com/kamend/KinectDelaunay
Absolut Blank
December 6th, 2012I am happy to report our little documentary from the installation we did for the Absolut Blank campaign in Bulgaria. This is probably my favorite project for this year and really like to thank Absolut for giving us the freedom to do everything the way we wanted!
ABSOLUT BLANK | PHORMATIK from PHORMATIK on Vimeo.
Of course everything interactive was done inside Openframeworks!
Diamond Theory
October 22nd, 2012Kyle McDonalds has recently posted on Twitter, about porting graphics from old issues of COMPUTER Graphics and Art. Here is my attempt to visualize the “Diamond Theory” by Steven H. Cullinane, I found in the issue from Feb, 1977.
Diamond Theory from Kamen Dimitrov on Vimeo.
Kinect Triangulation to SVG (FREE OSX App)
September 11th, 2012Here is a little tool for OSX, I made with Openframeworks. It’s an app for turning Kinect triangulated blobs into SVG files. Please note that you need a Kinect camera plugged in to use this!
You can download it here: KinectToSVG.zip
Usage:
) Unzip in a folder and do not delete the “data/” folder.
) Plug-in your Kinect
) Stay close to it, around 1-1.5m
) Press ‘space’ to save your SVG
) Your SVG is saved in the “data/” folder with the name “mesh.svg”, it will overwrite the file, everytime you save!
) Have fun!
* Props to Marek Bereza and his Kinect blob triangulation code found in https://github.com/HellicarAndLewis/Triptych
Openframeworks Experiments
September 10th, 2012I have been playing around, doing some experiments with Openframeworks lately. Here are some of the results, I will post the code, if somebody is interested.
Earth – is a unrealistic visualisation of the earth and some flying fireballs between random countries :)
Twitter Particles – is a realtime Twitter visualisation, using particles.
Source Code: https://github.com/kamend/TwitterParticles