Example #1
0
/*!
 *=============================================================================
 *
 * \brief Grabber::setProfile
 * \param name
 * \return
 *
 *=============================================================================
 */
bool Grabber::setProfile(Voxel::String name)
{
    bool rc = false;
    const Map<int, Voxel::String> &profiles = 
                            _depthCamera->getCameraProfileNames();
    for (auto &p: profiles) 
    {
        std::cout << "Checking (" << p.second << ") against name (" << name << ")" << std::endl;

        if (p.second == name) 
        {
            int profile_id = p.first;
            
            ConfigurationFile *c = 
                _depthCamera->configFile.getCameraProfile(p.first);
                
            if (c && c->getLocation() == ConfigurationFile::IN_CAMERA) 
            {
                if (_depthCamera->setCameraProfile(profile_id)) 
                {
                    rc = true;
                    break;
                }
            }
        }
    }
    return rc;
}
Example #2
0
bool TOFApp::setProfile(Voxel::String name)
{
   bool rc = false;
   const Map<int, Voxel::String> &profiles = _depthCamera->getCameraProfileNames();
   for (auto &p: profiles) {
      if (p.second == name) {
         int profile_id = p.first;
         ConfigurationFile *c = _depthCamera->configFile.getCameraProfile(p.first);
         if (c && c->getLocation() == ConfigurationFile::IN_CAMERA) {
            if (_depthCamera->setCameraProfile(profile_id)) {
              rc = true;
              break;
            }
         }
      }
   }
   return rc;
}
Example #3
0
bool TOFApp::connect()
{
   const vector<DevicePtr> &devices = _sys.scan();
   if (devices.size() > 0) {
      _depthCamera = _sys.connect(devices[0]);
      if (!_depthCamera) 
         return false; 
      if (!_depthCamera->isInitialized()) 
         return false;
   }
   else 
      return false;

    int profile_id;
    const Map<int, Voxel::String> &profiles = _depthCamera->getCameraProfileNames();
    for(auto &p: profiles)
    {
      std::cout << p.first << ", " << p.second;

      if (p.second == "Calibrated Normal")
         profile_id = p.first;
      
      ConfigurationFile *c = _depthCamera->configFile.getCameraProfile(p.first);
      
      if(c && c->getLocation() == ConfigurationFile::IN_CAMERA)
        std::cout << " (HW)";
      
      std::cout << std::endl;
    }

    cout << "Profile ID = " << profile_id << endl;
    if (_depthCamera->setCameraProfile(profile_id)) 
       cout << "Profile setting succeeded." << endl;

   _depthCamera->registerCallback(DepthCamera::FRAME_DEPTH_FRAME, frameCallback);
   _depthCamera->setFrameSize(_dimen);  
   _depthCamera->set("illum_power_percentage", _illum_power);
   _depthCamera->set("intg_duty_cycle", _intg);
   _depthCamera->start();

   return true;
}