Page 1 of 1
Automatic conversion of the viewpoint in a PCD data
Posted: Tue Apr 11, 2023 4:48 pm
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.
Re: Automatic conversion of the viewpoint in a PCD data
Posted: Mon Apr 17, 2023 6:35 pm
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'.
Re: Automatic conversion of the viewpoint in a PCD data
Posted: Tue Apr 18, 2023 12:53 pm
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!
Re: Automatic conversion of the viewpoint in a PCD data
Posted: Tue Apr 18, 2023 6:43 pm
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.