Advertisement
KindDragon

loadDistortionTable

Jul 31st, 2013
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. ArtecCaptureSDK::ErrorCode ArtecScannerBase::loadDistortionTable( unsigned int correctHash, const std::wstring& pathToCalibration )
  2. {
  3.     fs::path dirName = pathToCalibration;
  4.     if(!fs::exists(dirName) || !fs::is_directory(dirName))
  5.         return ErrorCode_InvalidOperation;
  6.     fs::directory_iterator end;
  7.     for (fs::directory_iterator dirIt(dirName); dirIt != end;  ++dirIt)
  8.     {
  9.         if(fs::is_regular_file(dirIt->path()) && fs::extension(dirIt->path()) == ".corr")
  10.         {
  11.             if (!distortionTable_->load_from_protoBuf(dirIt->path().string().c_str()) )
  12.                 continue;
  13.  
  14.             std::string tab_pack;          
  15.  
  16.             distortionTable_->save_to_protoBuf_str( tab_pack );
  17.  
  18.             unsigned int hash = _crc32((const unsigned char*)tab_pack.c_str(), tab_pack.length());
  19.  
  20.             if (hash == correctHash)
  21.             {
  22.                 ILog* log = getArtecSDKLog();
  23.                 if (log)
  24.                     log->verbose(L"Tabulation file successfully loaded");
  25.                 return ErrorCode_OK;
  26.             }
  27.         }
  28.     }
  29.     return ErrorCode_InvalidOperation;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement