fingerdemo/fingerdemo.cpp
int runpstereo(gs::PhotometricStereo *pstereo)
{
  string scanfile = setpath + "FingerData/coin/scan.yaml";

  cout << "Running photometric stereo algorithm on " << scanfile << endl;

  // Load a scan from the scan file
	
  auto scan = gs::LoadScanFromYAML(scanfile, gs::DefaultAnalysisManager());

  // Load images from scan
  auto images = gs::util::LoadImages(scan->imagePaths());

  cout << "Loaded " << images.size() << " images" << endl;
  if (images.size() == 0)
    return 1;

  // Important to only compute 3D data with a specified crop region
  gs::RectI croproi(300,500,1000,1250);
  
  // Do surface normal reconstruction
  auto nrm = pstereo->linearNormalMap(images, croproi);

  // Integrate normals into heightmap
  cout << "Integrating surface normals..." << endl;
  auto poisson = gs::CreateIntegrator(gs::Version());
  auto heightmap = poisson->integrateNormalMap(nrm, pstereo->resolution());

  // Save surface as TMD
  string out1 = setpath + "FingerData/coin/output.tmd";
  cout << "Saving heightmap: " << out1 << endl;
  gs::util::WriteTMD(out1, heightmap, pstereo->resolution(), 0.0, 0.0);

  // Save normal map
  string out2 = setpath + "FingerData/coin/output_nrm.png";
  cout << "Saving normal map: " << out2 << endl;
  gs::util::WriteNormalMap(out2, nrm, 16);

  return 0;
}
/*
 * Run pstereo algorithm on sine wave sample data
 */
Run pstereo algorithm on sine wave sample data
Run pstereo algorithm on sine wave sample data
int runpstereo(gs::PhotometricStereo *pstereo)
{
  string scanfile = setpath + "FingerData/coin/scan.yaml";
  cout << "Running photometric stereo algorithm on " << scanfile << endl;
  auto scan = gs::LoadScanFromYAML(scanfile, gs::DefaultAnalysisManager());
  auto images = gs::util::LoadImages(scan->imagePaths());
  cout << "Loaded " << images.size() << " images" << endl;
  if (images.size() == 0)
    return 1;
  gs::RectI croproi(300,500,1000,1250);
  auto nrm = pstereo->linearNormalMap(images, croproi);
  cout << "Integrating surface normals..." << endl;
  auto poisson = gs::CreateIntegrator(gs::Version());
  auto heightmap = poisson->integrateNormalMap(nrm, pstereo->resolution());
  string out1 = setpath + "FingerData/coin/output.tmd";
  cout << "Saving heightmap: " << out1 << endl;
  gs::util::WriteTMD(out1, heightmap, pstereo->resolution(), 0.0, 0.0);
  string out2 = setpath + "FingerData/coin/output_nrm.png";
  cout << "Saving normal map: " << out2 << endl;
  gs::util::WriteNormalMap(out2, nrm, 16);
  return 0;
}
int runpstereo ( gs :: PhotometricStereo * pstereo ) { string scanfile = setpath + " " ; cout << " " << scanfile << endl ; auto scan = gs :: LoadScanFromYAML ( scanfile , gs :: DefaultAnalysisManager ( ) ) ; auto images = gs :: util :: LoadImages ( scan -> imagePaths ( ) ) ; cout << " " << images . size ( ) << " " << endl ; if ( images . size ( ) == 0 ) return 1 ; gs :: RectI croproi ( 300 , 500 , 1000 , 1250 ) ; auto nrm = pstereo -> linearNormalMap ( images , croproi ) ; cout << " " << endl ; auto poisson = gs :: CreateIntegrator ( gs :: Version ( ) ) ; auto heightmap = poisson -> integrateNormalMap ( nrm , pstereo -> resolution ( ) ) ; string out1 = setpath + " " ; cout << " " << out1 << endl ; gs :: util :: WriteTMD ( out1 , heightmap , pstereo -> resolution ( ) , 0.0 , 0.0 ) ; string out2 = setpath + " " ; cout << " " << out2 << endl ; gs :: util :: WriteNormalMap ( out2 , nrm , 16 ) ; return 0 ; }
Run pstereo algorithm on sine wave sample data
Run pstereo algorithm on sine wave sample data
// Load a scan from the scan file
 // Load images from scan
 // Important to only compute 3D data with a specified crop region
 // Do surface normal reconstruction
 // Integrate normals into heightmap
 // Save surface as TMD
 // Save normal map
