Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement interfaces ofBaseVideo and ofxBase3DVideo #41

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

luteberget
Copy link

I suggest that the ofxOpenNI class should inherit from the virtual classes ofBaseVideo and ofxBase3DVideo. This will let other addons and apps easily switch between, for example, ofxKinect and ofxOpenNI, since they both provide the same basic data. For example, on some platforms ofxKinect is much easier to setup, while on other platforms ofxOpenNI might be your choice. If these interfaces are implemented, it is easy to switch between camera backends.

Implementation consists of:

  • ofBaseVideo, since the depth cams can supply regular color video. This interface adds
    • getPixels() and getPixelsRef(), which gives data that is already available through getImagePixels()
    • close() and isFrameNew(), which only need to be forwarded to stop() and isNewFrame().
  • ofxBase3DVideo, as defined in ofxKinect. This interface adds:
    • The function getDepthPixels() now return unsigned char* instead of ofPixels&. Use getDepthPixelsRef() to get the ofPixel reference. This will break any apps which already use getDepthPixels, but is should be easy to update them to use getDepthPixelsRef instead.
    • getDepthPixelsTextureReference(), which was already implemented.
    • getDistancePixels(), which is a 2D array of floats. This is used to transfer the depth/distance (in mm) independently of the data type (short) which is used by the backend.

The function getDepthPixels() now return unsigned char* instead of ofPixels&. Use getDepthPixelsRef() to get the ofPixel reference.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant