Artec 3D Scanning SDK  2.0
IScanner.h
Go to the documentation of this file.
1 /********************************************************************
2 *
3 * Project Artec 3D Scanning SDK
4 *
5 * Purpose: Universal interface for capture from any scanner
6 *
7 * Copyright: Artec Group
8 *
9 ********************************************************************/
10 #pragma once
11 
12 #include <artec/sdk/base/Errors.h>
13 #include <artec/sdk/base/IRef.h>
14 #include <artec/sdk/base/Matrix.h>
17 
18 namespace artec { namespace sdk { namespace base
19 {
20 
21 class IImage;
22 class IFrameMesh;
23 class IArrayString;
24 
25 } } };
26 
27 namespace artec { namespace sdk { namespace capturing
28 {
29 using namespace artec::sdk::base::errors;
30 
34 
35 struct FrameProcessorDesc;
36 
37 class IScanner;
38 class IScannerObserver;
39 class IFrame;
40 class IFrameProcessor;
41 class IArrayScannerId;
42 class IScannerSynchronization;
43 
44 extern "C"
45 {
46 /**
47 * Enumerate all cameras connected to the computer.
48 * @param camerasList Camera list to return.
49 * @param deviceTypeMask Obsolete, do not use it.
50 */
52  enumerateCameras(IArrayString **camerasList, int deviceTypeMask = -1);
53 
54 /**
55 * @brief Initialize cameras connected to the computer via the Ethernet interface.
56 * @details Once this function is called, it is possible to detect these cameras.
57 */
58 #ifdef USE_POINTGRAY_SDK
60  forceIpForGigECameras();
61 #endif
62 
63 /**
64 * Enumerate all scanners connected to the computer.
65 * @param scannersList Scanner list to return.
66 * @param deviceTypeMask Obsolete, do not use it.
67 * @param pathToConfig Path to calibration settings. Pass NULL for the default location.
68 */
70  enumerateScanners(IArrayScannerId **scannersList, int deviceTypeMask = -1, const wchar_t* pathToConfig = NULL);
71 
72 /**
73 * Create selected scanner.
74 * @param scanner Scanner to return.
75 * @param id Scanner ID.
76 * @param scannerIndex Scanner index in bundle.
77 */
79  createScanner(IScanner **scanner, const ScannerId *id, int scannerIndex = 0);
80 }
81 
82 
83 /**
84 * Real-time decoding and triangulation settings.
85 */
87 {
88  int minimumObjectSize; ///< Decoder settings. Parameter for filtering triangles by patch size.
89  int trianglesStep; ///< Triangulation settings. Frame-mesh point density
90  double edgeLengthThreshold; ///< Threshold for filtering triangles by edge length (in mm)
91  bool interpolate; ///< Switch interpolation on/off
92  double maxInterpolatedLength; ///< Maximum size of holes to be interpolated (in mm)
93  double maxAngle; ///< Maximum angle between plane of polygon and camera direction (in degrees)
94 };
95 
96 /// Interface to initiate capture and control scanner parameters (fps, texture, exposure time, flash, etc.)
98 {
99 public:
100  /**
101  * Create IFrameProcessor processor.
102  * @param desc Frame processor settings. Use NULL for the default settings.
103  */
104  virtual ErrorCode createFrameProcessor( IFrameProcessor** processor, FrameProcessorDesc* desc = NULL ) = 0;
105 
106  /**
107  * Initialize FrameProcessor settings with the default values.
108  * @param desc Fill desc with the default processing parameters.
109  */
110  virtual ErrorCode initFrameProcessorDesc( FrameProcessorDesc* desc ) = 0;
111 
112  /**
113  * Get current frame number.
114  * @return Current frame number.
115  */
116  virtual int getFrameNumber() const = 0;
117 
118  /**
119  * Perform capture. Safe multi-thread function.
120  * @param frame Captured frame.
121  * @param captureTexture If it is true, texture will be captured.
122  */
123  virtual ErrorCode capture( IFrame** frame, bool captureTexture ) = 0;
124 
125  /**
126  * Capture texture only. Safe multi-thread function.
127  * @param texture Captured texture image.
128  * @param frameNumber Current frame number.
129  */
130  virtual ErrorCode captureTexture( IImage** texture, int* frameNumber ) = 0;
131 
132  /**
133  * Get scanner ID.
134  * @return Pointer to the scanner ID.
135  */
136  virtual const ScannerId* getId() const = 0;
137 
138  /**
139  * Get scanner information.
140  * @return Pointer to the ScannerInfo structure.
141  */
142  ///
143  virtual const ScannerInfo* getInfo() const = 0;
144 
145  /**
146  * Get scanner event handler.
147  * @return Pointer to the IScannerObserver structure.
148  */
149  virtual IScannerObserver* getObserver() const = 0;
150 
151  /**
152  * Set scanner event handler.
153  * @param handler Pointer to the scanner event handler.
154  */
155  virtual ErrorCode setObserver(IScannerObserver* handler) = 0;
156 
157  /**
158  * Get 3D camera gain value.
159  * @return Gain value.
160  */
161  virtual float getGain() const = 0;
162 
163  /**
164  * Get texture gain value.
165  * @return Texture gain value.
166  */
167  virtual float getTextureGain() const = 0;
168 
169  /**
170  * Set texture gain value.
171  * @param gain Texture gain value.
172  */
173  virtual void setTextureGain( float gain ) = 0;
174 
175  /**
176  * Get lower bound of the texture gain range.
177  * @return Minimum texture gain value.
178  */
179  virtual float getTextureGainMin() const = 0;
180 
181  /**
182  * Get upper bound of the texture gain range.
183  * @return Maximum texture gain value.
184  */
185  virtual float getTextureGainMax() const = 0;
186 
187  /**
188  * Get the current scanning speed (in FPS).
189  * @return Currently requested scanning speed in FPS (frames per second).
190  */
191  virtual float getFPS() const = 0;
192 
193  /**
194  * Set the required scanning speed (in FPS).
195  * @param fps FPS (frames per second) value.
196  */
197  virtual void setFPS(float fps) = 0;
198 
199  /**
200  * Return maximum possible scanning speed (in FPS) for this scanner type.
201  * @return FPS value.
202  */
203  virtual float getMaximumFPS() const = 0;
204 
205  /**
206  * Get matrix for texture mapping. Pass it in the data-processor mapTexture() function.
207  * @return Reference to the texture mapping matrix.
208  */
209  virtual const artec::sdk::base::Matrix3x4D& getTextureMappingMatrix() const = 0;
210 
211  /**
212  * Get parameters that are needed for texture brightness normalization.
213  * @return Texture flash power coefficient at a distance of 1000mm
214  * (This corresponds approximately to the white plain intensity.)
215  */
216  virtual float getTextureIllumination() const = 0;
217 
218  /**
219  * Convert RAW buffer to RGB (use standard capturer conversion).
220  * Perform de-mosaicing, correct vignetting and distortion.
221  * @param fullTexture Full resolution output texture.
222  * @param rawTexture Input raw texture directly from the scanner sensor.
223  */
224  virtual ErrorCode convertTextureFull( IImage** fullTexture, const IImage* rawTexture ) const = 0;
225 
226  /**
227  * Convert RAW texture buffer from device to half-resolution RGB (fast option).
228  * Perform de-mosaicing, correct vignetting and distortion.
229  * @param halfTexture Half resolution output texture.
230  * @param rawTexture Input raw texture, directly from the scanner sensor.
231  */
232  virtual ErrorCode convertTextureHalf( IImage** halfTexture , const IImage* rawTexture ) const = 0;
233 
234  /**
235  * Enable/Disable flash bulb for geometry camera.
236  * @param enable The true stands for enabled flash, false for disabled.
237  */
238  virtual void enableFlash(bool enable) = 0;
239 
240  /**
241  * Get geometry camera flash bulb state.
242  * @return The true value stands for enabled flash, false for disabled.
243  */
244  virtual bool isFlashEnabled() const = 0;
245 
246  /**
247  * Set flash delay.
248  * @param vl Flash delay to set (in milliseconds).
249  */
250  virtual void setFlashDelay( float vl ) = 0;
251 
252  /**
253  * Get flash delay.
254  * @return vl Get flash delay (in milliseconds).
255  */
256  virtual float getFlashDelay() const = 0;
257 
258  /**
259  * Get flash delay duration in for the geometry camera.
260  * @return Flash duration in milliseconds.
261  */
262  virtual float getFlashDuration() const = 0;
263 
264  /**
265  * Enable/Disable flash bulb for the texture camera.
266  * @param enable The true value stands for enabled flash, false for disabled.
267  */
268  virtual void enableTextureFlash(bool enable) = 0;
269 
270  /**
271  * Get texture camera flash bulb state.
272  * @return The true value stands for enabled flash, false for disabled.
273  */
274  virtual bool isTextureFlashEnabled() const = 0;
275 
276  /**
277  * Set external synchronization trigger delay.
278  * @param delay Trigger delay in milliseconds.
279  */
280  virtual void setTriggerDelay(float delay) = 0;
281 
282  /**
283  * Get external synchronization trigger delay.
284  * @return Trigger delay in milliseconds.
285  */
286  virtual float getTriggerDelay() const = 0;
287 
288  /**
289  * Enable/Disable scanner trigger for external synchronization.
290  * @param vl The true value stands for enabled synchronization, false for disabled.
291  */
292  virtual void setUseHwTrigger( bool vl ) = 0;
293 
294  /**
295  * Get status of the external synchronization scanner trigger.
296  * @return True when synchronization is enabled, false in other cases.
297  */
298  virtual bool getUseHwTrigger() const = 0;
299 
300  /**
301  * Enable/Disable texture camera trigger to synchronize texture and depth.
302  * @param vl True for enabled synchronization, false for disabled.
303  */
304  virtual void setTextureUseHwTrigger( bool vl ) = 0;
305 
306  /**
307  * Get status of the texture camera synchronization trigger.
308  * @return True when synchronization is enabled, false in other cases.
309  */
310  virtual bool getTextureUseHwTrigger() const = 0;
311 
312  /**
313  * Set external synchronization trigger delay for texture camera.
314  * @param delay Delay in milliseconds.
315  */
316  virtual void setTextureTriggerDelay(float delay) = 0;
317 
318  /**
319  * Get external synchronization trigger delay for texture camera.
320  * @return delay Delay in milliseconds.
321  */
322  virtual float getTextureTriggerDelay() const = 0;
323 
324  /**
325  * Set texture camera shutter speed (exposure time).
326  * @param vl Exposure time in milliseconds.
327  */
328  virtual void setTextureShutterSpeed( float vl ) = 0;
329 
330  /**
331  * Get texture camera shutter speed (exposure time).
332  * @return Shutter speed in milliseconds.
333  */
334  virtual float getTextureShutterSpeed() const = 0;
335 
336  /**
337  * Enable/Disable autoexposure.
338  * @param enable The true value stands for enabled auto exposure, false for disabled.
339  */
340  virtual void enableAutoExposure(bool enable) = 0;
341 
342  /**
343  * Get autoexposure state.
344  * @return True if autoexposure is enabled, false in other cases.
345  */
346  virtual bool isAutoExposureEnabled() const = 0;
347 
348  /**
349  * Enable/Disable auto white balance.
350  * @param enable The true value stands for enabled auto white balance, false for disabled.
351  */
352  virtual void enableAutoWhiteBalance(bool enable) = 0;
353 
354  /**
355  * Get state of auto white balance.
356  * @return True if auto auto white balance is enabled, false in other cases.
357  */
358  virtual bool isAutoWhiteBalanceEnabled() const = 0;
359 
360  /**
361  * Set scanner bundle synchronization interface.
362  * @param sync IScannerSynchronization interface created using the createScannerSynchronization function. Set NULL for disabled synchronization.
363  */
364  virtual ErrorCode setScannerSynchronization(IScannerSynchronization* sync) = 0;
365 
366  /**
367  * Get current scanner bundle synchronization interface.
368  * @return Current IScannerSynchronization interface. NULL if synchronization is disabled.
369  */
370  virtual IScannerSynchronization* getScannerSynchronization() const = 0;
371 
372  /**
373  * Scanner fire trigger. It's not a thread-safe function.
374  * @param captureTexture - True if the scanner captures both texture and geometry, false if only geometry.
375  */
376  virtual ErrorCode fireTrigger(bool captureTexture) = 0;
377 
378  /**
379  * Retrieve captured frame. It's not a thread-safe function.
380  * @param frame Captured frame.
381  * @param captureTexture If the value is true, texture will be retrieved as well.
382  */
383  virtual ErrorCode retrieveFrame(IFrame** frame, bool captureTexture) = 0;
384 
385  /**
386  * Get scanner index in the bundle.
387  * @return Scanner index in the bundle. The "0" value means that no bundle is used.
388  */
389  virtual int getScannerIndex() const = 0;
390 
391  /**
392  * Set scanner index in the bundle.
393  * @param newIndex Scanner index in the bundle.
394  */
395  virtual void setScannerIndex(int newIndex) = 0;
396 };
397 
398 } } } // namespace artec::sdk::capturing
399 
ErrorCode ACAPTURESDK_LINK_SPEC enumerateScanners(IArrayScannerId **scannersList, int deviceTypeMask=-1, const wchar_t *pathToConfig=NULL)
Initialize cameras connected to the computer via the Ethernet interface.
bool interpolate
Switch interpolation on/off.
Definition: IScanner.h:91
double maxAngle
Maximum angle between plane of polygon and camera direction (in degrees)
Definition: IScanner.h:93
int minimumObjectSize
Decoder settings. Parameter for filtering triangles by patch size.
Definition: IScanner.h:88
Interface for common raster image objects.
Definition: IImage.h:126
int trianglesStep
Triangulation settings. Frame-mesh point density.
Definition: IScanner.h:89
double maxInterpolatedLength
Maximum size of holes to be interpolated (in mm)
Definition: IScanner.h:92
Indexed triangle mesh with optional texture.
Definition: IFrameMesh.h:42
Current scanner's parameters.
Definition: ScannerInfo.h:56
ErrorCode ACAPTURESDK_LINK_SPEC createScanner(IScanner **scanner, const ScannerId *id, int scannerIndex=0)
Create selected scanner.
Scanner identification parameters.
Definition: ScannerInfo.h:35
#define ACAPTURESDK_LINK_SPEC
Matrix of unspecified size.
Definition: GenericMatrix.h:30
Interface for captured frame (image + depth).
Definition: IFrame.h:25
double edgeLengthThreshold
Threshold for filtering triangles by edge length (in mm)
Definition: IScanner.h:90
ErrorCode ACAPTURESDK_LINK_SPEC enumerateCameras(IArrayString **camerasList, int deviceTypeMask=-1)
Enumerate all cameras connected to the computer.
Interface to receive notifications about scanner's life events (e.g., buttons pressed).
Raw frames processor (frames from scanner).
Interface to initiate capture and control scanner parameters (fps, texture, exposure time...
Definition: IScanner.h:97
Real-time decoding and triangulation settings.
Definition: IScanner.h:86
Interface for array of strings that supports smart reference counting.
Definition: IString.h:49
Interface that implements reference counting and life-time management.
Definition: IRef.h:22