PCD data scale become smaller

Feel free to ask any question here
Post Reply
hakase
Posts: 4
Joined: Tue Nov 01, 2022 7:47 am

PCD data scale become smaller

Post by hakase »

Hi.

I'm really new here in CloudCompare, georeference, and other general stuff. So please apologise if my question is simple.


I just learned how to align one cloud with the real coordinates. When I finish pointing the coordinates, I click align and press Enter, it becomes like this.

pcd-blurry-1.png
pcd-blurry-1.png (100.33 KiB) Viewed 1257 times
If you notice, the scale on the right bottom becomes smaller.
pcd-original-1.png
pcd-original-1.png (165.14 KiB) Viewed 1257 times

It becomes a problem for me when I upload it to Tier4 Vector Map Builder. The PCD does not load anything.

Question is, how can I do georeference properly without the PCD data becoming smaller (compared to using a scale)?

Thank you, guys. Let me know if you need more information on this.
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: PCD data scale become smaller

Post by daniel »

Can you give us an example of coordinates you use? Aren't they very large?

Normally, CC should suggest to apply a Global Shift in this case. Did you see any such question?
Daniel, CloudCompare admin
hakase
Posts: 4
Joined: Tue Nov 01, 2022 7:47 am

Re: PCD data scale become smaller

Post by hakase »

daniel wrote: Sat Nov 05, 2022 2:28 pm Can you give us an example of coordinates you use? Aren't they very large?

Normally, CC should suggest to apply a Global Shift in this case. Did you see any such question?
I'm not sure if it's large or not. The local coordinates in PCD are as follows:

-88.459938, 2.612011, 5.125117
14.940063, 4.112011, 1.525117
11.940063, 115.112015, 0.225117
-87.259941, 95.912010, 3.825117

And global coordinates that I align the point pairs are:

2.92782083, 101.66214713
2.92698574, 101.66187756
2.92664684, 101.66282667
2.92748175, 101.66301075

For the Global Shift, when I load the PCD, it didn't ask to apply Global Shift. Do I need to convert .pcd to .las first? Or I can just directly adjust Global Shift?

Below I attached my screenshot of aligning the pair points.
pcd-pair-points.png
pcd-pair-points.png (208.56 KiB) Viewed 1223 times


If you notice, the scale now is 85. This happened when I click align. It rotates the PCD and the scale becomes smaller. The scale is now 0.002
pcd-pair-points-after-aligned.png
pcd-pair-points-after-aligned.png (132.28 KiB) Viewed 1223 times
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: PCD data scale become smaller

Post by daniel »

Ah, I understand now. Since all the Z coordinates of your reference points are 0 (= 2D points), and you tell CC to scale the align cloud (3D) to best fit the points, it ends up rescaling the aligned points with a ridiculously small scale (so that 'P.z * 0 = 0' basically).

You can't align 3D points with 2D points this way... You would have to make a clone of your cloud first, then flatten this clone (with 'Edit > Multiply / Scale' and use 0 for the Z coordinate only). Then align the flat clone with your 2D reference points. Look at the resulting matrix in the Console (F8) and copy it (CTRL+C). And eventually, you can apply the same matrix to the original point cloud with 'Edit > Apply Transformation' (and paste the matrix there, either with the 'clipboard' button or with the CTRL+V shortcut).
Daniel, CloudCompare admin
hakase
Posts: 4
Joined: Tue Nov 01, 2022 7:47 am

Re: PCD data scale become smaller

Post by hakase »

daniel wrote: Tue Nov 08, 2022 10:54 pm Ah, I understand now. Since all the Z coordinates of your reference points are 0 (= 2D points), and you tell CC to scale the align cloud (3D) to best fit the points, it ends up rescaling the aligned points with a ridiculously small scale (so that 'P.z * 0 = 0' basically).

You can't align 3D points with 2D points this way... You would have to make a clone of your cloud first, then flatten this clone (with 'Edit > Multiply / Scale' and use 0 for the Z coordinate only). Then align the flat clone with your 2D reference points. Look at the resulting matrix in the Console (F8) and copy it (CTRL+C). And eventually, you can apply the same matrix to the original point cloud with 'Edit > Apply Transformation' (and paste the matrix there, either with the 'clipboard' button or with the CTRL+V shortcut).
Hi!

Thank you for keep updating me on this.

I've tried your method, but it seems the scale still become smaller. I recorded my step and posted it on Youtube, can you check and point out where I did my mistake? Here is my video link on Youtube.

https://youtu.be/5CEO4O8Vt6E

Glad you can help me with this. Thank you for your time.



EDIT:


I just found out. The global coordinate after alignment and scale is a bit weird.
pcd-weird-coordinates-1-after-alignment.png
pcd-weird-coordinates-1-after-alignment.png (21.41 KiB) Viewed 1169 times
The picture above is after alignment. What I can see is the coordinates in the yellow box should be in the red box, and vice versa. But it's fine on the left and right sides. Do you know why this happened?

Below is example:
pcd-weird-coordinates-2.png
pcd-weird-coordinates-2.png (29.26 KiB) Viewed 1169 times
pcd-weird-coordinates-2-onmaps.png
pcd-weird-coordinates-2-onmaps.png (270.4 KiB) Viewed 1169 times
Thank you!
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: PCD data scale become smaller

Post by daniel »

Oh, I think it doesn't really makes sense to use 2D angular coordinates to match 3D cartesian coordinates... The 'align' tool performs rigid registration, and I'm not sure that converting from cartesian to angular coordinates is particularly 'rigid'.

The other issue, once again, that the resolution of the 4 pairs of GPS coordinates you picked in Google Maps is actually very coarse (something bigger than 10 cm in average I believe). You would need more digits to get a reliable result (an angula resolution that would be equivalent to mm accuracy I guess).

At least for now, if you want to make things a little bit better (visually) and have a better feel of what's going on, you could truncate the coordinates when doing the registration so as to limit the numerical incaccuracy:
2.92782083, 101.66214713 --> (- 2.9) * 100 = 2.782083 / (-101.6) * 100 = 6.6214713
2.92698574, 101.66187756 --> 2.698574, 6.187756
2.92664684, 101.66282667 --> 2.664684, 6.282667
2.92748175, 101.66301075 --> 2.748175, 6.301075

Then you can manually scale and recenter the resulting cloud (with 'Edit > Multiply / scale' for divide by 100, and then with 'Edit > Apply transformation' to translate the cloud of X = +2.9 and Y = +101.6.

I would be interested to see what's the result in this case. But I believe the result will still be off due to the metric/angular projection, and the limited angular resolution of Google Maps GPS coordinates.
Daniel, CloudCompare admin
hakase
Posts: 4
Joined: Tue Nov 01, 2022 7:47 am

Re: PCD data scale become smaller

Post by hakase »

Hi Daniel.

I did as you suggested. But it still did not produce the correct georeference.

What I did is flatten the pcd (z: 0), register coordinates local, and truncated global coordinates. scale up pcd to 100 times for all dimensions, and apply transformation (translate: x; 2.6, y; 101.6).

Did I miss anything step here?

Below is the result.
pcd-incorrect-georef.png
pcd-incorrect-georef.png (129.6 KiB) Viewed 1082 times
Here is the video from when I do the georeference.

https://youtu.be/FKtys-czzm8
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: PCD data scale become smaller

Post by daniel »

Well, my point was only to improve the numerical accuracy and fix this 'strips' issue.

But I still think you can't register a cartesian 3D point cloud with angular coordinates with a rigid registration algorithm such as the ones implemented in CC.
Daniel, CloudCompare admin
Post Reply