c# - Kinect 2 streams get stuck after fetching 3 frames -
i using kinect v2 , have small program shows body , color streams stream stops sending frames after fetching 3 frames. here code:
_sensor = kinectsensor.getdefault(); if (_sensor != null) { _sensor.open(); _reader = _sensor.openmultisourceframereader(framesourcetypes.color | framesourcetypes.depth | framesourcetypes.infrared | framesourcetypes.body); _reader.multisourceframearrived += reader_multisourceframearrived; }
and here how getting frames
console.writeline("==== frame found ===="); var reference = e.framereference.acquireframe(); // body using (var frame = reference.colorframereference.acquireframe()) { if (frame != null) { //stream.children.clear(); var c_frame = reference.colorframereference.acquireframe(); imagebrush ib = new imagebrush(); image im = new image(); rgb.source = frame.tobitmap(); var b_frame = reference.bodyframereference.acquireframe(); _bodies = new body[b_frame.bodyframesource.bodycount]; b_frame.getandrefreshbodydata(_bodies); if (_bodies[0].istracked) { stream.drawskeleton(_bodies[0]); if (recording) { recorder.recordframe(_bodies[0]); } } b_frame.getandrefreshbodydata(_bodies); } }
most build target set 32 bit cpu. set 64 bit.
Comments
Post a Comment