Superformula 3d

December 8th, 2013

Here is a simple implementation of the Superformula(http://en.wikipedia.org/wiki/Superformula) inside Openframeworks, feel free to play around and modify.

screenshot

Screen Shot 2013-12-09 at 12.11.50 AM

Git: https://github.com/kamend/Superformula3d

OpenGL Instancing inside Openframeworks

September 28th, 2013

OpenGL Instancing

Here is a short example on how to implement OpenGL Instancing with GLSL

Simple Shape Matching with kNearest and OpenCV

May 27th, 2013

Here 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, 2013

Recently 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:

face2

deer_crystal

flower

head2

inside

And just a demo of the program:

Screen Shot 2013-04-30 at 7.01.41 PM

You could follow all my experiments at: http://kamend.tumblr.com or http://pinterest.com/dimitroff/

My favorite Wolfram CA rulesets

April 17th, 2013

After 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:

WolframCA_Rule105

WolframCA_Rule101

WolframCA_Rule89

WolframCA_Rule75

WolframCA_Rule73

WolframCA_Rule45

WolframCA_Rule54

WolframCA_Rule57

WolframCA_Rule62

WolframCA_Rule30

WolframCA_Rule139

WolframCA_Rule137

WolframCA_Rule135

WolframCA_Rule129

WolframCA_Rule110

WolframCA_Rule151

WolframCA_Rule153

WolframCA_Rule163

WolframCA_Rule167

WolframCA_Rule169

WolframCA_Rule242

WolframCA_Rule215

WolframCA_Rule214

WolframCA_Rule193

WolframCA_Rule182

Kinect Delaunay

April 9th, 2013

Some 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, 2012

I 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, 2012

Kyle 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, 2012

Here 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, 2012

I 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