The RCS format (Reality Capture Scan), one of the most popular formats for point cloud processing, is the basic format for point cloud attachments in .dwg files. PointCloud SDK provides access to the RCS format using a special service. This topic describes how you can use the ODA service to load data from the RCS format.
For reading point cloud data from .rcs files, the PointCloud SDK provides the RcsFileServices.tx
extension module. As any ODA module, RcsFileServices can be loaded using the loadModule()
method:
OdRxRcsFileServicesPtr pModule = odrxDynamicLinker()->loadModule("RcsFileServices");
The module contains a method that performs reading point cloud data from an .rcs file:
virtual OdPointCloudScanDatabasePtr readRcsFile(const OdString& filePath) const = 0
This method returns a pointer to OdPointCloudScanDatabase
object representing the .rcs file in runtime. The method takes as an argument a full path to the .rcs file to read.
There is another method which takes a pointer to the file buffer associated with the .rcs file:
virtual OdPointCloudScanDatabasePtr readRcsFile(OdStreamBuf* pFileBuff) const = 0
Once the data is read to an OdPointCloudScanDatabase
object, you get access to the information contained in the source file using the following OdPointCloudScanDatabase
class methods:
Method | Brief Description |
virtual OdString getScanDatabaseFilePath() const = 0; |
Gets the path to an .rcs file associated with the database |
virtual OdUInt64 getTotalAmountOfPoints() const = 0; |
Returns the total number of points in all voxels |
virtual OdString getScanId() const = 0; |
Gets the scan ID string |
virtual bool isLidarData() const = 0; |
Indicates whether the file contains LIDAR data |
virtual OdRcsVoxelIteratorPtr getVoxelIterator() const = 0; |
Creates a new voxel iterator and returns a shared pointer to it |
virtual OdUInt64 getAmountOfVoxels() const = 0; |
Gets the amount of voxels in the database |
virtual OdGeVector3d getTranslation() const = 0; |
Gets the translation vector from the database |
virtual OdGeVector3d getRotation() const = 0; |
Gets the rotation vector from the database. Each of this vector's coordinates is a rotation angle around the corresponding axis |
virtual OdGeVector3d getScale() const = 0; |
Gets the scale vector from the database |
virtual OdGeMatrix3d getTransformMatrix() const = 0; |
Forms the complete transformation matrix which integrates translation, rotation and scale |
virtual bool hasRGB() const = 0; |
Gets the hasRGB flag value from the database |
virtual bool hasNormals() const = 0; |
Gets the hasNormals flag value from the database |
virtual bool hasIntensity() const = 0; |
Gets the hasIntensity flag value from the database |
virtual OdGeExtents3d getExtents() const = 0; |
Gets the extents of the point cloud from the database |
virtual OdGeExtents3d getTransformedExtents() const = 0; |
Gets the extents of the point cloud and transforms it by the transformation matrix |
virtual bool getNormalizeIntensity() const = 0; |
Gets a flag indicating whether normalization is used for intensity values |
virtual float getMaxIntensity() const = 0; |
Returns the maximum intensity of all scan points from the current scan database |
virtual float getMinIntensity() const = 0; |
Returns the minimum intensity of all scan points from the current scan database |
virtual OdUInt32 getRangeImageWidth() const = 0; |
Returns the range image width |
virtual OdUInt32 getRangeImageHeight() const = 0; |
Returns the range image height |
Once the header of the .rcs file is loaded to OdPointCloudScanDatabase
object, you get the array of voxels: volume elements, each of which contains one or more points of the cloud.
Voxels are represented by the OdRcsVoxel
class.
You can iterate through all voxels from the voxels array using an OdRcsVoxelIterator
object, which can be created using the getVoxelIterator()
method of OdPointCloudScanDatabase
:
OdRcsVoxelIteratorPtr pVoxelIt = pScanDb->getVoxelIterator();
For example, to go through all voxel objects from the point cloud:
OdRcsVoxelIteratorPtr pVoxelIt = pScanDb->getVoxelIterator();
for (; !pVoxelIt->done(); pVoxelIt->step())
{
OdRcsVoxelPtr pVoxel = pVoxelIt->getVoxel();
...
}
The OdRcsVoxel
class provides the following methods:
Method | Brief Description |
virtual OdUInt32 getTotalNumberOfPoints() const = 0 |
Gets the number of points within the current voxel. |
virtual OdRcsPointDataIteratorPtr getPointDataIterator() const = 0 |
Creates a new point data iterator. |
virtual OdGeExtents3d getExtents() const = 0 |
Returns the extents of the voxel. |
You can iterate through all points of the voxel using an OdRcsPointDataIterator
object, which can be created using getPointDataIterator()
method of OdRcsVoxel
:
OdRcsPointDataIteratorPtr pPointDataIt = pVoxel->getPointDataIterator();
Current implementation of OdRcsPointDataIterator
provides the following methods to get point properties.
Method | Brief Description |
virtual OdUInt32 getPoints(OdGePoint3dArray& coordinates, OdCmEntityColorArray& colors,
OdUInt32 requiredNumberOfPoints) = 0 |
Fills the coordinates and color arrays. The iterator object steps forward. |
virtual OdUInt32 getPoints(OdGePoint3dArray& coordinates, OdCmEntityColorArray& colors, OdGeVector3dArray& normals,
OdUInt32 requiredNumberOfPoints) = 0 |
Fills arrays of coordinates, colors and normals. The iterator object steps forward. |
virtual OdUInt32 getPoints(OdGePoint3dArray& coordinates, OdCmEntityColorArray& colors, OdUInt16Array& normalIndexes,
OdUInt8Array& intensities, OdUInt32 requiredNumberOfPoints) = 0 |
Fills arrays of coordinates, colors, normal indexes and intensities. The iterator object steps forward. |
Each of these methods takes the number of points to obtain from the current voxel and fills the specified arrays with points data.
Specifying the requiredQty parameter allows you to save memory when processing a large point cloud, for example, when converting to another format. The returned value is an actual number of obtained points.
Each of these methods returns point coordinates relative to the minimum point (the lower left front point) of the voxel cell.
To get the global coordinates for a point within a cloud, add the coordinates of the minimum point to the point coordinates obtained by the getPoints() method. For example you may process points of the voxel in the following way:
OdGeExtents3d voxelExtents = pVoxel->getExtents();
OdUInt32 numberOfPoints = pVoxel->getTotalNumberOfPoints();
OdRcsPointDataIteratorPtr pPointDataIt = pVoxel->getPointDataIterator();
OdGePoint3dArray coords; OdCmEntityColorArray colors; OdUInt16Array normalIndexes; OdUInt8Array intensities;
pPointDataIt->getPoints(coords, colors, normalIndexes, intensities, numberOfPoints);
OdGePoint3d voxelExtentsMinPoint = voxelExtents.minPoint();
for (OdUInt32 pointIndex = 0; pointIndex < numberOfPoints; pointIndex++)
{
coords[pointIndex].asVector() += voxelExtentsMinPoint.asVector();
odPrintConsoleString(OD_T("\tcoordinates = (%lf, %lf, %lf);\n"), coords[pointIndex].x, coords[pointIndex].y,coords[pointIndex].z);
}
For more information, see also the RcsPointCloudReadEx sample application.
Basic Concept and List of Supported Point Cloud Formats
Convert Unstructured Point Cloud Formats to .rcs Files
Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.
|