Coder Social home page Coder Social logo

osc-colored-blob-tracking's Introduction

osc-colored-blob-tracking

blob tracking w/ color support via OSC

Installation

Either build the sources from sketch/ or download the latest release.

Usage

Launch the .app then listen to the port 32000.

When a blob is tracked, an OSC message is sent on /blob, with the following data structure :

position datatype description
0 int blob.ID
1 String blob.color_name
2 int blob.polygon.npoints
3 to npoints float blob.polygon.xpoints[]
npoints + 4 to npoints * 2 + 4 float blob.polygon.ypoints[]

When a blob is lost, an OSC message is sent on /remove with the following data structure :

position datatype description
0 int blob.ID

In order to consolidate serv/client syncing, an OSC message is sent every X millis (see class_oscWrapper:26) on /consolidate with the following data structure :

position datatype description
0 int blobs.length
1 to blobs.length int blobs_id[]

Example with Processing

import oscP5.*;
import netP5.*;

OscP5 oscP5;
NetAddress serverLocation;

void setup() {
  oscP5 = new OscP5(this, 32000);
  serverLocation = new NetAddress("127.0.0.1", 12000);
}

public void oscEvent(OscMessage message) {
  if (message.checkAddrPattern("/blob")) {
    int id = message.get(0).intValue();
    String colorName = message.get(1).stringValue();

    int npoints = message.get(2).intValue();
    int[] xpoints = new int[npoints];
    int[] ypoints = new int[npoints];

    for (int i = 0; i < npoints; i++) {
      xpoints[i] = message.get(i + 3).intValue();
      ypoints[i] = message.get(i + 3 + npoints).intValue();
    }

    // Blob blob = new Blob(this, id, colorName, xpoints, ypoints);

  } else if (message.checkAddrPattern("/remove")) {
    int id = message.get(0).intValue();
    // blobs.remove(id);
  }
}

Development

Requirements

Hardware
  • Webcam
Libraries

Ressources

License

MIT.

osc-colored-blob-tracking's People

Contributors

arnaudjuracek avatar

Stargazers

 avatar

Watchers

 avatar  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.