v-pnk / cadloc

Benchmark for visual localization on imperfect 3D mesh models from the Internet
https://v-pnk.github.io/cadloc/
BSD 3-Clause "New" or "Revised" License
23 stars 1 forks source link

Questions about model alignment. #3

Closed RUiN-jiarun closed 9 months ago

RUiN-jiarun commented 9 months ago

Hi, I've tried to check the Tref proveded in the benchmark page. It works well for Notre Dame A which is in obj file, however for other collada files (.dae), the transform matrix seems not quite correct as I apply the matrix in Meshlab. This also seems not correct when I export the model from Sketchup to obj file. So my question is: how can I perform transformation correctly to those collada files in order to align them to the reference ply mesh?

v-pnk commented 9 months ago

Hi @RUiN-jiarun , Can you share the downloaded CAD model in OBJ format where the alignment does not work?

If I remember correctly, in SketchUp, there is an OBJ export dialog where the orientation and scale of the global reference frame can be changed. Some parameters may have to be adjusted there.

RUiN-jiarun commented 9 months ago

Thanks for your quick reply! Here is a screenshot from Meshlab and I've applied the Tref of Notre Dame B to the obj file: snapshot01 During export in SketchUp 2023, I simply used the default settings. Screenshot 2024-01-17 000133 However in export to obj options, I've noticed you can select which axis towards to up direction and the model's unit. The obj file is here (w/o mtl and textures): notredame_b.zip

v-pnk commented 9 months ago

Ah, that's the SketchUp model on Sketchfab website. I think I downloaded either the glTF or GLB and converted it to OBJ with Blender. In Blender you have to select the Up and Front axes, so that's probably where the issue happened. Your model should be rotated by -90° around the Z-axis before applying the T_ref. So the new T_ref will be Tref @ T-90Z. For the Notre Dame B mesh it is:

-0.04308 -0.07366 -0.0008805 -1.525
0.0245 -0.01336 -0.08065 4.145
0.06947 -0.04097 0.02789 10.74
0 0 0 1

I'll update the T_ref on the website. Let me know if you have a similar issue with other models.

RUiN-jiarun commented 9 months ago

Thanks for reply! The new transform matrix does work well for my obj now :) So my problem is probably solved. image BTW, I also tried to import glTF and glb model from the Sketchfab website into Blender and I found there is a huge scale gap between the interent mesh and the refrence ply... I'm using blender 3.3.5 and here is a screenshot. image So I guess directly import dae/gltf/glb into Blender or Meshlab still exists potential problems on scale and unit. Export from SketchUp is the most reliable solution.