| 229 | ******************************/ |
| 230 | |
| 231 | void* HandExtractor::extractorThreadMethod(void) |
| 232 | { |
| 233 | unsigned int lastInputFrameVersion=0; |
| 234 | |
| 235 | while(true) |
| 236 | { |
| 237 | Kinect::FrameBuffer frame; |
| 238 | { |
| 239 | Threads::MutexCond::Lock inputLock(inputCond); |
| 240 | |
| 241 | /* Wait until a new frame arrives or the program shuts down: */ |
| 242 | while(runExtractorThread&&lastInputFrameVersion==inputFrameVersion) |
| 243 | inputCond.wait(inputLock); |
| 244 | |
| 245 | /* Bail out if the program is shutting down: */ |
| 246 | if(!runExtractorThread) |
| 247 | break; |
| 248 | |
| 249 | /* Work on the new frame: */ |
| 250 | frame=inputFrame; |
| 251 | lastInputFrameVersion=inputFrameVersion; |
| 252 | } |
| 253 | |
| 254 | /* Prepare a new output hand list: */ |
| 255 | HandList& newHandList=extractedHands.startNewValue(); |
| 256 | |
| 257 | /* Extract hands from the new input frame: */ |
| 258 | extractHands(frame.getData<DepthPixel>(),newHandList,0); |
| 259 | |
| 260 | /* Finalize the new extracted hands list in the output buffer: */ |
| 261 | extractedHands.postNewValue(); |
| 262 | |
| 263 | /* Pass the new output frame to the registered receiver: */ |
| 264 | if(handsExtractedFunction!=0) |
| 265 | (*handsExtractedFunction)(newHandList); |
| 266 | } |
| 267 | |
| 268 | return 0; |
| 269 | } |
| 270 | |
| 271 | HandExtractor::HandExtractor(const unsigned int sDepthFrameSize[2],const HandExtractor::PixelDepthCorrection* sPixelDepthCorrection,const PTransform& sDepthProjection) |
| 272 | :pixelDepthCorrection(sPixelDepthCorrection),depthProjection(sDepthProjection), |
nothing calls this directly
no outgoing calls
no test coverage detected