Extracting Sensor Position / Pose

Feel free to ask any question here
Post Reply
subo3
Posts: 13
Joined: Tue Dec 13, 2022 12:43 pm

Extracting Sensor Position / Pose

Post by subo3 »

Hello,

for a plugin i'm trying to figure out how to extract the sensor position (pose) of lidar point clouds.
Is it correct, that it's a member of Grid struct (ccGLMatrixd sensorPosition)? Doc: https://www.cloudcompare.org/doc/qCC_db ... 39a492038c

For my approach i'm thinking about iterating through the selected entities (point clouds in this case):

Code: Select all

ccHObject::Container selPw = appInterface->getSelectedEntities(); //create an instance of selected point clouds
	
for (int i = 0; i < selPw.size(); i++) 
{

}
Does anyone have an idea how to get to the sensor position of the point clouds in the container?
Thank you!
daniel
Site Admin
Posts: 7458
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Extracting Sensor Position / Pose

Post by daniel »

The most robust way is to loop through the selected entities, and check if it's a sensor object (ccSensor) or a point cloud (ccPointCloud).

If it's a sensor, you can retrieve its position directly. If it's a cloud, you'll have to look at its children (entities) and look for a ccSensor among them. You can look in the code base for either 'ccSensor' or 'ccGBLSensor' and you'll find many examples.
Daniel, CloudCompare admin
subo3
Posts: 13
Joined: Tue Dec 13, 2022 12:43 pm

Re: Extracting Sensor Position / Pose

Post by subo3 »

First of all thank you for the help!

Do you know a way to access the children? My entities are ccPointCloud objects. I tried a lot and looked for functions, somehow i didn't find a solution, unfortunately.
daniel
Site Admin
Posts: 7458
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Extracting Sensor Position / Pose

Post by daniel »

With the 'getChild()' method? (and the number of children can be retrieved with getChildrenNumber:
https://github.com/CloudCompare/CloudCo ... ect.h#L131
Daniel, CloudCompare admin
Post Reply