Ejemplo n.º 1
0
  void KinectInterfacePrimesense::init(const char* device_uri) {
    initOpenNI(device_uri);

    // Create a thread pool for parallelizing the UVD to depth calculations
    uint32_t num_threads = KINECT_INTERFACE_NUM_WORKER_THREADS;
    tp_ = new jtil::threading::ThreadPool(num_threads);
    if (KINECT_INTERFACE_NUM_CONVERTER_THREADS > 1) {
      uint32_t n_pixels = depth_dim_[0] * depth_dim_[1];
      uint32_t n_pixels_per_thread = 1 + n_pixels / num_threads;  // round up
      for (uint32_t i = 0; i < num_threads; i++) {
        uint32_t start = i * n_pixels_per_thread;
        uint32_t end = std::min<uint32_t>(((i + 1) * n_pixels_per_thread) - 1,
          n_pixels - 1);
        pts_world_thread_cbs_.pushBack(MakeCallableMany(
          &KinectInterfacePrimesense::convertDepthToWorld, this, start, end));
        rgb_thread_cbs_.pushBack(MakeCallableMany(
          &KinectInterfacePrimesense::convertRGBToDepth, this, start, end));
      }
    }

    if (device_uri) {
      cout << "Finished initializing device " << device_uri << "..." << endl;
    } else {
      cout << "Finished initializing openNI device..." << endl;
    }
  }
Ejemplo n.º 2
0
OpenNIDevice::OpenNIDevice(const QString devicePath)
    : m_devicePath(devicePath)
    , m_opened(false)
    , m_manual_registration(false)
{
    // Init OpenNI
    _mutex_counter.lock();
    _instance_counter++;
    if (!_initialised) {
        initOpenNI();
    }
    _mutex_counter.unlock();

    // Videostreams
    m_depthStreams = new openni::VideoStream*[1];
    m_depthStreams[0] = &m_oniDepthStream;
    m_colorStreams = new openni::VideoStream*[1];
    m_colorStreams[0] = &m_oniColorStream;
}