DAVID4 SDK  1.8.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
SimpleCalibration.cpp
1 /// @example SimpleStructuredLightScanner.cpp
2 ///
3 /// Shows usage of calibration with the StructuredLightScanner class.
4 
5 #include "davidSDK/david.h"
6 
7 namespace examples {
8 
9 
10 /// Shows usage of calibration with the StructuredLightScanner class.
11 /// Simple example class for usage of StructuredLightScanner class via david::Client::sls interface.
13 {
14  try
15  {
16  // Connection to DAVID server is established within constructor.
17  // david::Client::Disconnect is automatically called in destructor of david::Client.
18  david::Client david;
19  david.Connect();
20 
21  // Select screen and camera.
22  david.sls().SetScreenID(3);
23  david.sls().SelectCamera("DAVID-CAM-3-M (8F6DEE1E)");
24 
25  // Tells DAVID server to calibrate, and save calibration parameters to .cal files.
26  david.sls().Calibrate(120.0);
27  david.sls().ExportCalibration("camera.cal", "projector.cal");
28 
29  // Re-import calibration (this step is not necessary here, it is just for demonstration/testing):
30  david.sls().ImportCalibration("camera.cal", "projector.cal");
31 
32  // david::Client::Disconnect is automatically called in destructor of david::Client
33  // at the end of this { } block
34  }
35  catch (david::Exception& e)
36  {
37  e.PrintError();
38  }
39 }
40 
41 
42 } // namespace examples