Artec 3D Scanning SDK  2.0
IScanningProcedureObserver.h
Go to the documentation of this file.
1 /********************************************************************
2 *
3 * Project Artec 3D Scanning SDK
4 *
5 * Purpose: Scanning procedure observer interface.
6 *
7 * Copyright: Artec Group
8 *
9 ********************************************************************/
10 
11 #ifndef _ISCANNINGPROCEDUREOBSERVER_H_
12 #define _ISCANNINGPROCEDUREOBSERVER_H_
13 
14 #include <artec/sdk/base/Errors.h>
15 #include <artec/sdk/base/RefBase.h>
16 #include <artec/sdk/base/IScan.h>
20 
21 
22 namespace artec { namespace sdk { namespace scanning
23 {
24 using namespace artec::sdk::base::errors;
25 
26 /**
27 * Represents different processing states of the frame being captured.
28 */
30 {
31  FrameState_Ok, ///< Frame is captured and processed correctly. A new frame is generated.
32  FrameState_TriggerCaptureFailed, ///< Failed to start capturing (hardware error). No frame is generated.
33  FrameState_CaptureFailed, ///< Failed to capture a frame image from the camera. No frame is generated.
34  FrameState_ReconstructionFailed, ///< Failed to reconstruct a frame mesh from the image captured. No frame is generated.
35  FrameState_RegistrationFailed, ///< Failed to register the frame mesh after successful reconstruction. A new frame is generated with registration error below zero.
36  FrameState_TextureMappingFailed, ///< Failed to map raw texture to the frame mesh. A new frame is generated with no texture.
37  FrameState_AddToScanFailed, ///< Failed to add the processed frame to a scan, probably caused by the lack of memory.
38 
39  FrameState_ForceDword = 0x7fffffff /* force 32-bit size enum */
40 };
41 
42 /**
43 * Represents several aspects of the frame processing in the course of frame processing pipeline
44 * \note If you use frames obtained using either callbacks (onFrameCaptured or onFrameScanned), ensure that you release them before leaving those callbacks.
45 * To access these frames, use AlgorithmWorkset::out.
46 */
48 {
49  const artec::sdk::base::IFrameMesh* frame; ///< New frame to add
50  artec::sdk::base::Matrix4x4D transformation; ///< Frame transformation matrix
51  const artec::sdk::base::IImage* rawTexture; ///< Raw frame texture camera image
52  double registrationError; ///< Registration error (negative means registration failed)
53  bool geometryKeyFrame; ///< Geometry skeleton key frame
54  bool textureKeyFrame; ///< Texture key frame
55  FrameState frameState; ///< State of the frame (processing stage where error occurred: capture/reconstruction/registration)
56  ErrorCode errorCode; ///< Type of the error occurred during processing. ErrorCode_OK means frameState is FrameState_Ok
57  int scannerIndex; ///< Scanner index in the bundle. 0 if no bundle is used.
58  artec::sdk::base::TimeStamp timeStamp; ///< Frame capture time
59 };
60 
61 /**
62 * Interface to receive notifications about events during scanning (e.g., frame scanned).
63 */
65 {
66 public:
67  /**
68  * This method is called after a new frame is captured.
69  * It is synchronized, so it can be called from many different threads.
70  * These callbacks are called in the order in which the frames are captured, so no additional sorting is needed.
71  * Please do not make large calculations here as one may delay frame processing and decrease FPS.
72  * @param frameInfo the info about the frame captured.
73  */
74  virtual void onFrameCaptured( const RegistrationInfo* frameInfo ) = 0;
75 
76  /**
77  * This method is called after a new frame is added to a scan.
78  * It is synchronized, so it can be called from many different threads.
79  * These callbacks are called in the order in which the frames are captured, so no additional sorting is needed.
80  * Please do not make large calculations here as one may delay frame processing and decrease FPS.
81  * @param frameInfo the info about the frame scanned.
82  */
83  virtual void onFrameScanned( const RegistrationInfo* frameInfo ) = 0;
84 
85  /**
86  * This method is called after the scanning is finished, though before texture post-processing.
87  * Please ensure that all previously used textures are released.
88  * @param scannerIndex the number of the scanner in bundle. 0 stands for no bundle.
89  */
90  virtual void onScanningFinished( int scannerIndex ) = 0;
91 };
92 
93 /**
94 * The preferred way to use IScanningProcedureObserver is through using this class as a base.
95 * It already supports reference counting.
96 */
97 class ScanningProcedureObserverBase : public artec::sdk::base::RefBase<IScanningProcedureObserver>
98 {
99 };
100 
101 } } } // namespace artec::sdk::scanning
102 
103 #endif // _ISCANNINGPROCEDUREOBSERVER_H_
artec::sdk::base::TimeStamp timeStamp
Frame capture time.
double registrationError
Registration error (negative means registration failed)
Interface for common raster image objects.
Definition: IImage.h:126
The preferred way to use IScanningProcedureObserver is through using this class as a base...
Transformation matrix.
Definition: Matrix.h:26
artec::sdk::base::Matrix4x4D transformation
Frame transformation matrix.
FrameState frameState
State of the frame (processing stage where error occurred: capture/reconstruction/registration) ...
Failed to start capturing (hardware error). No frame is generated.
ErrorCode errorCode
Type of the error occurred during processing. ErrorCode_OK means frameState is FrameState_Ok.
Indexed triangle mesh with optional texture.
Definition: IFrameMesh.h:42
Represents several aspects of the frame processing in the course of frame processing pipeline...
bool geometryKeyFrame
Geometry skeleton key frame.
Failed to add the processed frame to a scan, probably caused by the lack of memory.
const artec::sdk::base::IFrameMesh * frame
New frame to add.
Failed to capture a frame image from the camera. No frame is generated.
Time stamp structure.
Definition: TimeStamp.h:20
int scannerIndex
Scanner index in the bundle. 0 if no bundle is used.
const artec::sdk::base::IImage * rawTexture
Raw frame texture camera image.
Failed to map raw texture to the frame mesh. A new frame is generated with no texture.
Interface to receive notifications about events during scanning (e.g., frame scanned).
Interface that implements reference counting and life-time management.
Definition: IRef.h:22
Failed to register the frame mesh after successful reconstruction. A new frame is generated with regi...
Failed to reconstruct a frame mesh from the image captured. No frame is generated.
Implementation of IRef interface. To create your own class, inherit it from RefBase.
Definition: RefBase.h:75
FrameState
Represents different processing states of the frame being captured.
Frame is captured and processed correctly. A new frame is generated.