demo/demo.cpp
int runpstereo(gs::PhotometricStereo *pstereo)
{
	string scanfile = setpath + "R513-500/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;

	// Do surface normal reconstruction
	auto nrm = pstereo->nonlinearNormalMap(images, pstereo->roi());

	// 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 + "R513-500/output.tmd";
	cout << "Saving heightmap: " << out1 << endl;
	gs::util::WriteTMD(out1, heightmap, pstereo->resolution(), 0.0, 0.0);


	// Save normal map
	string out2 = setpath + "R513-500/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 + "R513-500/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;
	auto nrm = pstereo->nonlinearNormalMap(images, pstereo->roi());
	cout << "Integrating surface normals..." << endl;
	auto poisson = gs::CreateIntegrator(gs::Version());
	auto heightmap = poisson->integrateNormalMap(nrm, pstereo->resolution());
	string out1 = setpath + "R513-500/output.tmd";
	cout << "Saving heightmap: " << out1 << endl;
	gs::util::WriteTMD(out1, heightmap, pstereo->resolution(), 0.0, 0.0);
	string out2 = setpath + "R513-500/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 ; auto nrm = pstereo -> nonlinearNormalMap ( images , pstereo -> roi ( ) ) ; 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
 // Do surface normal reconstruction
 // Integrate normals into heightmap
 // Save surface as TMD
 // Save normal map
