![]() |
SCENE C++ API
2.0.32
|
Interface to access information and functionality of scans. More...
#include <lsscan.h>
Public Types | |
enum | ExportFormat { DXF = 0, E57 = 1, FLS = 2, IGS = 3, POD = 4, PTS = 5, PTX = 6, WRL = 7, XYB = 8, XYZ = 9, CPE = 10, BMP = 11, JPG = 12, PNG = 13, TIF = 14, LAS = 15 } |
The different export formats that are supported. More... | |
enum | DataFormat { COLOR, REFLECTION, AUTO, COLOR_AND_REFLECTION } |
The different data formats that are supported by FARO scans. More... | |
Public Member Functions | |
bool | dataAvailable (DataFormat format=AUTO) const |
Determines whether data is available in the specified format. More... | |
bool | dataLoaded (DataFormat format=AUTO) const |
Determines whether data is loaded in the specified format. More... | |
LSResult::Result | loadData (DataFormat format=AUTO) |
Load the scan data in the specified format. More... | |
void | unloadData () |
Unloads the scan data. More... | |
LSResult::Result | exportData (LSString filePath, ExportFormat format) |
Exports the scan data in the defined format. More... | |
LSScanIterator< LSPointXYZRGB > | getScanIterator () |
Gets a scan iterator which allows to iterate over the available scan data. More... | |
LSScanIterator< LSPointXYZI > | getScanReflectionIterator () |
Gets a scan iterator which allows to iterate over the available scan data. More... | |
bool | spatialDataAvailable () const |
Determines whether spatial scan data (scan point cloud) is available for this scan. More... | |
LSResult::Result | exportSpatialData (LSString filePath, ExportFormat format) |
Exports the spatial scan data in the defined format. More... | |
LSIterator< LSPointXYZRGB > | getSpatialScanIterator () |
Gets an iterator which allows to iterate over the spatial scan data (scan point cloud). More... | |
LSSphericalIterator< LSPointSphericalRGB > | getSphericalCoordinatesIterator () |
Gets an iterator which allows to iterate over the structured scan data (r, phi, theta). More... | |
ref_ptr< const LSAttributeContainer > | getScannerParameters () |
Gets the scanner parameters which were used to take the scan. More... | |
ref_ptr< const LSAttributeContainer > | getScannerParameters () const |
Gets the scanner parameters which were used to take the scan. More... | |
int | getNumCols () const |
Gets the number of available columns. More... | |
int | getNumRows () const |
Gets the number of available rows. More... | |
void | setPointColor (int col, int row, uint8_t r, uint8_t g, uint8_t b) |
Sets the RGB color value of the point at the specified col/row position. More... | |
void | setPointReflection (int col, int row, float reflection) |
Sets the reflection value of the point at the specified col/row position. More... | |
void | deletePoint (int col, int row) |
Deletes the point at the specified its col/row position. More... | |
void | select2d (int colLeft, int colRight, int rowTop, int rowBottom) |
Creates a rectangular selection on the scan. More... | |
LSResult::Result | getOverlap (int &startColumn1, int &columns1, int &startColumn2, int &columns2) const |
Get overlap areas of the scan. More... | |
bool | isUnstructured () const |
Check if a scan contains unstructured data. More... | |
bool | getPointColor (int col, int row, uint8_t &r, uint8_t &g, uint8_t &b) const |
Gets the RGB color value of the point at the specified col/row position. More... | |
bool | getPointColor (int col, int row, uint8_t &r, uint8_t &g, uint8_t &b, bool &isRGB) const |
Overloaded method. More... | |
bool | getPointReflection (int col, int row, float &reflection) const |
Gets the reflection value of the point at the specified col/row position. More... | |
LSScanIterator< LSPointXYZN > | getScanNormalsIterator () |
Gets a scan iterator which allows to iterate over the available scan data. More... | |
bool | getPointNormal (int col, int row, float &nX, float &nY, float &nZ) const |
Gets the normal vector components of the point at the specified col/row position. More... | |
LSIterator< LSPointXYZN > | getSpatialScanNormalsIterator () |
Gets a scan iterator which allows to iterate over the available spatial scan data (scan point cloud) and extract its corresponding normals. More... | |
![]() | |
Eigen::Matrix4d | getTransformationToGlobal () const |
Calculates the transformation matrix which transforms local object coordinates to global coordinates. More... | |
void | select () |
Selects this object. More... | |
LSIterator< ref_ptr< LSObject > > | getChildIterator () const |
Gets an iterator which can be used for a breadth-first iteration over all objects below the object in the object hierarchy. More... | |
ref_ptr< LSObject > | getParent () const |
Returns the parent of this object. More... | |
unsigned int | getNumChildren () const |
Returns the number of children of this object. More... | |
ref_ptr< LSObject > | getChild (unsigned int n) const |
Returns the n-th child of this object. More... | |
ref_ptr< LSObject > | getChild (LSString name) const |
Returns the child of this object with a given name. More... | |
bool | rmChild (unsigned int n) |
Removes a child from this object. More... | |
bool | rmChild (LSString name) |
Removes a child from this object. More... | |
LSResult::Result | addChild (LSString name, LSString typeName, ref_ptr< LSObject > &childOut) |
Creates a new child of the given type. More... | |
LSResult::Result | generateUniqueChildName (const LSString &baseName, LSString &nameOut) const |
Generates a valid and unique name for a new child of this object based on the provided base name. More... | |
LSResult::Result | setParent (ref_ptr< LSObject > newParent) |
Changes the parent of this object. More... | |
![]() | |
LSString | getTypeName () const |
Gets the type name of this instance. More... | |
LSString | getName () const |
Gets the name of the container. More... | |
LSResult::Result | setName (LSString name) |
Sets the name of the container. More... | |
LSString | getUuid () const |
Returns the unique id of the container. More... | |
LSString | assignUuid () |
Assigns a unique id to the container if the container does not not yet have a unique id. More... | |
unsigned int | getNumAttributes () const |
Get the number of attributes in the container. More... | |
LSString | getAttributeName (unsigned int index) const |
Get the name of an attribute in the container. More... | |
unsigned int | getAttributeIndex (LSString name) const |
Get the index of an attribute in the container. More... | |
LSAttribute | getAttribute (unsigned int index) const |
Get an attribute based on its index. More... | |
LSAttribute | getAttribute (LSString name) const |
Get an attribute based on its name. More... | |
LSResult::Result | setAttribute (unsigned int index, const LSAttribute &attribute) |
Set an attribute based on its index. More... | |
LSResult::Result | setAttribute (LSString name, const LSAttribute &attribute) |
Set an attribute based on its name. More... | |
LSResult::Result | addCustomAttribute (LSString name, const LSAttribute &attribute) |
Add a new custom attribute to the container. More... | |
bool | removeCustomAttribute (LSString name) |
Remove a custom attribute from the container. More... | |
unsigned int | getNumFields () const |
Returns the number of fields in the container. More... | |
ref_ptr< LSAttributeContainer > | getField (unsigned int index) const |
Returns the field at position n in the container. More... | |
ref_ptr< LSAttributeContainer > | getField (const LSString &name) const |
Returns the field with the given name. More... | |
LSResult::Result | addField (const LSString &name, const LSString &typeName, ref_ptr< LSAttributeContainer > &fieldOut) |
Add a field to the container. More... | |
bool | rmField (const LSString &name) |
Removes the field with a given name from the container. More... | |
Additional Inherited Members | |
![]() | |
void | ref () const |
Increments the internal reference counter. More... | |
void | unref () const |
Decrements the internal reference counter. More... | |
Interface to access information and functionality of scans.
enum ExportFormat |
The different export formats that are supported.
enum DataFormat |
The different data formats that are supported by FARO scans.
bool dataAvailable | ( | DataFormat | format = AUTO | ) | const |
Determines whether data is available in the specified format.
format | The data format to check the availability for. |
bool dataLoaded | ( | DataFormat | format = AUTO | ) | const |
Determines whether data is loaded in the specified format.
format | The data format to check the load state for. |
LSResult::Result loadData | ( | DataFormat | format = AUTO | ) |
Load the scan data in the specified format.
format | The data format to load. |
void unloadData | ( | ) |
Unloads the scan data.
LSResult::Result exportData | ( | LSString | filePath, |
ExportFormat | format | ||
) |
Exports the scan data in the defined format.
ATTENTION: Make sure that the data is available and loaded in any format before calling this method!
filePath | The path to the export destination. |
format | The format to be used for the export. Supported formats are DXF, E57, FLS, IGS, POD, PTS, PTX, WRL, XYB, XYZ, CPE, LAS, BMP, JPG, PNG and TIF. |
LSScanIterator<LSPointXYZRGB> getScanIterator | ( | ) |
Gets a scan iterator which allows to iterate over the available scan data.
The returned points are in global coordinates. ATTENTION: Make sure that the data is available and loaded in any format before calling this method! If this iterator is used to iterate over reflection data, the intensity values will be mapped to RGB values using a contrast enhancement algorithm.
LSScanIterator<LSPointXYZI> getScanReflectionIterator | ( | ) |
Gets a scan iterator which allows to iterate over the available scan data.
The returned points are in global coordinates. ATTENTION: Make sure that reflection data is available and loaded before calling this method!
bool spatialDataAvailable | ( | ) | const |
Determines whether spatial scan data (scan point cloud) is available for this scan.
LSResult::Result exportSpatialData | ( | LSString | filePath, |
ExportFormat | format | ||
) |
Exports the spatial scan data in the defined format.
filePath | The path to the export destination. |
format | The format to be used for the export. Supported formats are DXF, E57, IGS, POD, PTS, WRL, XYB, XYZ, CPE and LAS. |
LSIterator<LSPointXYZRGB> getSpatialScanIterator | ( | ) |
Gets an iterator which allows to iterate over the spatial scan data (scan point cloud).
Call spatialDataAvailable() to check there is spatial data available for this scan. The returned points are in global coordinates.
LSSphericalIterator<LSPointSphericalRGB> getSphericalCoordinatesIterator | ( | ) |
Gets an iterator which allows to iterate over the structured scan data (r, phi, theta).
This iterator will return points in the scans local coordidate system. All non-existing or deleted points will return with zero distance (r=0). ATTENTION: Call this method only on structured scans and loaded data! Make sure that the data is available and loaded in any format before calling this method! If this iterator is used to iterate over reflection data, the intensity values will be mapped to RGB values using a contrast enhancement algorithm.
Our polar coordinates are defined as follows:
x axis points equals to horizontal direction of 1. scan beam z axis is equal to the up direction phi is meant to be turned in clockwise direction theta == 0 in horizontal direction phi <– [0,2*PI], theta <– [0,PI[
(1) x = radius * cos(phi) * cos(theta) (2) y = -radius * sin(phi) * cos(theta) (3) z = radius * sin(theta)
ref_ptr<const LSAttributeContainer> getScannerParameters | ( | ) |
Gets the scanner parameters which were used to take the scan.
Will return a null pointer for non-FARO-scans, for example imported E57 files!
ref_ptr<const LSAttributeContainer> getScannerParameters | ( | ) | const |
Gets the scanner parameters which were used to take the scan.
Will return a null pointer for non-FARO-scans, for example imported E57 files!
int getNumCols | ( | ) | const |
Gets the number of available columns.
int getNumRows | ( | ) | const |
Gets the number of available rows.
void setPointColor | ( | int | col, |
int | row, | ||
uint8_t | r, | ||
uint8_t | g, | ||
uint8_t | b | ||
) |
Sets the RGB color value of the point at the specified col/row position.
Make sure that the scan is loaded with color data before calling this method!
col | The points column position. |
row | The points row position. |
r | The points red value will be set to this. Allowed range is [0,255]. |
g | The points green value will be set to this. Allowed range is [0,255]. |
b | The points blue value will be set to this. Allowed range is [0,255]. |
void setPointReflection | ( | int | col, |
int | row, | ||
float | reflection | ||
) |
Sets the reflection value of the point at the specified col/row position.
Make sure that the scan is loaded with reflection data before calling this method!
col | The points column position. |
row | The points row position. |
reflection | The points reflection will be set to this value; range [0,1]. |
void deletePoint | ( | int | col, |
int | row | ||
) |
Deletes the point at the specified its col/row position.
This will only mark the 3D and depth information for this point as deleted. The color and reflection values remain unchanged. Make sure that the scan data is loaded before calling this method!
void select2d | ( | int | colLeft, |
int | colRight, | ||
int | rowTop, | ||
int | rowBottom | ||
) |
Creates a rectangular selection on the scan.
colLeft | The left points column position. |
colRight | The right points column position. |
rowTop | The top points row position. |
rowBottom | The bottom points row position. |
LSResult::Result getOverlap | ( | int & | startColumn1, |
int & | columns1, | ||
int & | startColumn2, | ||
int & | columns2 | ||
) | const |
Get overlap areas of the scan.
This method requires the scan to be loaded. FARO scans can contain areas with overlap where the scanner recorded more than 180 degrees for a scan half. Scans without overlap, for example imported unstructured scans, return 0 for all output parameters.
startColumn1 | Output parameter with the starting column of the first overlap area. |
columns1 | Output parameter with size of the first overlap area in columns. |
startColumn2 | Output parameter with the starting column of the second overlap area. |
columns2 | Output parameter with size of the second overlap area in columns. |
bool isUnstructured | ( | ) | const |
Check if a scan contains unstructured data.
Structured data is organized in rows and columns. Unstructured scans are just a list of 3D points in no meaningful order. Do NOT use their row and column indices to determine the neighboring points! A typical example for structured data are Focus laser scans with proper rows and columns. A typical example for unstructured data are Freestyle scans or imported CPE files.
bool getPointColor | ( | int | col, |
int | row, | ||
uint8_t & | r, | ||
uint8_t & | g, | ||
uint8_t & | b | ||
) | const |
Gets the RGB color value of the point at the specified col/row position.
Make sure that the scan is loaded with color data before calling this method!
col | The points column position. |
row | The points row position. |
r | Red output parameter, will be set to a value in the range [0,255]. |
g | Green output parameter, will be set to a value in the range [0,255]. |
b | Blue output parameter, will be set to a value in the range [0,255]. |
bool getPointColor | ( | int | col, |
int | row, | ||
uint8_t & | r, | ||
uint8_t & | g, | ||
uint8_t & | b, | ||
bool & | isRGB | ||
) | const |
Overloaded method.
Gets the RGB color value of the point at the specified col/row position. Make sure that the scan is loaded with color data before calling this method!
col | The points column position. |
row | The points row position. |
r | Red output parameter, will be set to a value in the range [0,255]. |
g | Green output parameter, will be set to a value in the range [0,255]. |
b | Blue output parameter, will be set to a value in the range [0,255]. |
isRGB | Flag that states wheather the color is a ScanPt RGB value. False, if the RGB value derived from encoded laser intensity/reflection values. |
bool getPointReflection | ( | int | col, |
int | row, | ||
float & | reflection | ||
) | const |
Gets the reflection value of the point at the specified col/row position.
Make sure that the scan is loaded with reflection data before calling this method!
col | The points column position. |
row | The points row position. |
reflection | This output parameter will be set to a value in the range [0,1]. |
LSScanIterator<LSPointXYZN> getScanNormalsIterator | ( | ) |
Gets a scan iterator which allows to iterate over the available scan data.
The returned points and normal vectors are in global coordinates. ATTENTION: Make sure that the data is available and loaded in any format before calling this method! Further, this method should be called on the processed data for getting accurate values of the components of the normal vector.
bool getPointNormal | ( | int | col, |
int | row, | ||
float & | nX, | ||
float & | nY, | ||
float & | nZ | ||
) | const |
Gets the normal vector components of the point at the specified col/row position.
Make sure that the scan is loaded with any data format before calling this method! Further, this method should be called on the scan which is processed for getting accurate values of the components of the normal vector
col | The points column position. |
row | The points row position. |
nX | X component of the normal vector. |
nY | Y component of the normal vector. |
nZ | Z component of the normal vector. |
LSIterator<LSPointXYZN> getSpatialScanNormalsIterator | ( | ) |
Gets a scan iterator which allows to iterate over the available spatial scan data (scan point cloud) and extract its corresponding normals.
The returned points are in global coordinates. See also getSpatialScanIterator() and spatialDataAvailable(). ATTENTION: Make sure that the spatial data is available before calling this method! Further, this method should be called on the processed data for getting accurate values of the components of the normal vector.