Automatic conversion of the viewpoint in a PCD data

Feel free to ask any question here
Post Reply
Ziyang Xu
Posts: 2
Joined: Tue Apr 11, 2023 2:26 pm

Automatic conversion of the viewpoint in a PCD data

Post by Ziyang Xu »

As we know, the default viewpoint of a PCD file is 0 0 0 1 0 0 0. But when I use CC to open a PCD file and save as another new PCD file without any translation or rotation operation, the viewpoint of the PCD file has been automatically changed by CC. And I do not know why this happens and if there is any solution to stop this kind of automatic conversion. Because, when the viewpoint was changed, some PCL functions might give me some incorrect results.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Automatic conversion of the viewpoint in a PCD data

Post by daniel »

Looking at the code, I see that in the absence of an associated sensor object, the default orientation is an identity quaternion, and that's what we provide to the PCL function (pcl::io::savePCDFile).

Therefore, I guess in your case you have a sensor object. So one solution would maybe simply to manually delete this sensor object (if you want the default orientation).

But when looking at the loading part of the code, I see that once again CC simply converts the quaternion returned by the pcl::PCDReader::readHeader function to a 3D transformation matrix. I don't see any manual swapping of vectors, or an additional transformation... So it's not clear why it's not 'transparent'.
Daniel, CloudCompare admin
Ziyang Xu
Posts: 2
Joined: Tue Apr 11, 2023 2:26 pm

Re: Automatic conversion of the viewpoint in a PCD data

Post by Ziyang Xu »

Many thanks to Daniel! I checked the CC and PCD file again.Here is something I find out:

When I manually delete the sensor object and do some rotation and movement of the point cloud, the viewpoint of the new saved PCD file will always be (0,0,0,1,0,0,0).But if I keep the sensor object, the viewpoint(which is the sensor's location and orientation) will also be changed with the rotation and movement of point cloud.

In the past, I thought that no matter we keep the sensor or not, the viewpoint would not change,it should always be (0,0,0,1,0,0,0). Maybe that is my problem and really sorry for the trouble I caused for you!
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Automatic conversion of the viewpoint in a PCD data

Post by daniel »

Ah yes, if you rotate the cloud, then the sensor will change as well (and stay 'relative' to the cloud). So I would say this behavior is normal.
Daniel, CloudCompare admin
Post Reply