Code Monkey home page Code Monkey logo

ofxpca's Introduction

ofxPCA

An OpenFrameworks addon that implements the Principal Component Analysis dimensionality reduction technique. This technique is useful for finding the axes that explain the most variation in data. This can be used for finding the orientation of a set of points or the normal to a cluster of unoriented points.

This library uses the Eigen linear algebra library for its matrix routines.

Usage

// Make a vector of ofVec3fs that you want to do PCA on,
// for example the vertices of an ofMesh:
ofxPCAResult result = pca.analyze(mesh.getVertices());
// The ofxPCAResult object gives you the eigenvectors and
// eigenvalues sorted in descending order of the eigenvalues,
// i.e. by the most principal component to the least:
cout << "top eigenvalue: " << result.eigenvalues[0] << endl;
ofVec3f ev1 = result.eigenvectors[0]
cout << "top eigenvector: " <<  ev1.x << "m" << ev1.y << "," << ev1.z << endl;

Protip

If you get weird compilation errors after importing this addon, make sure that inside of ofxPCA/libs/Eigen/include/Eigen the src/ folder is not included in XCode as a compilation target. If that folder appears in your XCode project, delete it (but make sure to select Remove References rather than Move to Trash). We need those files to exist, but we don't want XCode to try to compile them.

ofxpca's People

Contributors

atduskgreg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.