ofTheo / ofxKinect

legacy openFrameworks wrapper for the xbox kinect (OF pre-0.8.0+ only) - ofxKinect is now included and is being maintained in OF releases
MIT License
540 stars 105 forks source link

isFrameNew() is counterintuitive #46

Closed kylemcdonald closed 13 years ago

kylemcdonald commented 13 years ago

it currently makes more sense to just call update() every frame than to use isFrameNew(). should we just remove isFrameNew()? it doesn't make sense to add grabFrame because kinect runs differently than the video grabber.

danomatika commented 13 years ago

I included that function for Chris and the fact that it's required by ofBaseVideo. Why does it make more sense? Does the kinect thread grab images faster then the main Glut thread renders?

kylemcdonald commented 13 years ago

maybe i'm just using it wrong. i tried to write:

if(kinect.isFrameNew()) {
    kinect.update();
}

and it wasn't working. should i just update() every frame, outside of isFrameNew()?

arturoc commented 13 years ago

yes, then ask for isFrameNew, in case you want to do any analysis on the data you avoid to do it twice like that, is the same as the videoGrabber:

kinect.update(); if(kinect.isFrameNew()) { cv... }

kylemcdonald commented 13 years ago

aha, i thought it was more like the ofVideoGrabber style where it was:

kinect.grabFrame();
if(kinect.isFrameNew()) {
    kinect.update();
}

but since there wasn't a grabFrame as it's threaded, it didn't make any sense. i see now. still slightly inconsistent with ofVideoGrabber, but i understand the use.

arturoc commented 13 years ago

but ofVideoGrabber is the same...

kylemcdonald commented 13 years ago

oh wow, you're totally right arturo. i've been using it wrong for a long time. it looks like:

void ofVideoGrabber::grabFrame(){
    update();
}

i wonder why i thought you had to do it the way i wrote above? maybe that's from an older example?

thanks :)

arturoc commented 13 years ago

:)

danomatika commented 13 years ago

... yeah I was wondering what you were talking about Kyle ... :D