chimeres
chimeres
chimeres.bin
File Size:
144.70 MB
License:
Date:
10 February 2025
An example with to parts to apply ICP registration.
Features
A CloudComPy script to apply ICP registration:
#!/usr/bin/env python3
import os
import sys
import math
import psutil
os.environ["_CCTRACE_"]="ON" # only if you want C++ debug traces
import cloudComPy as cc
objs = cc.importFile("chimeres.bin")
chimere_1_mesh = objs[0][0] # mesh, first part of the object
chimere_2_mesh = objs[0][1] # mesh, second part of the object
chimere_1_cloud = objs[1][0] # cloud, first part of the object
chimere_2_cloud = objs[1][1] # cloud, second part of the object
chimere_2_manualRot = objs[1][2] # cloud, second part of the object, very approximately aligned (hand rotation with the CloudCompare GUI)
chimere_1_mesh.setName("chimere_1_mesh")
chimere_2_mesh.setName("chimere_2_mesh")
chimere_1_cloud.setName("chimere_1_cloud")
chimere_2_cloud.setName("chimere_2_cloud")
chimere_2_manualRot.setName("chimere_2_manualRot")
# ICP with chimere_1_mesh and chimere_2_cloud does not work (neither with GUI nor with Python): ICP requires some first alignment
# ICP with the second part "pre aligned" by hand: OK, same result as CloudCompare GUI
res=cc.ICP(data=chimere_2_manualRot, model=chimere_1_mesh, finalOverlapRatio=0.5, method=cc.CONVERGENCE_TYPE.MAX_ERROR_CONVERGENCE)
tr1 = res.transMat
print(tr1.toString())
chimere_2_manualRot_transformed = chimere_2_manualRot.cloneThis() # = res.aligned.cloneThis() # note: res.aligned is data!
chimere_2_manualRot_transformed.applyRigidTransformation(tr1)
chimere_2_manualRot_transformed.setName("chimere2_manualRot_transformed_afterICP")
cc.SaveEntities([chimere_1_mesh, chimere_2_manualRot, chimere_2_manualRot_transformed],"chimeres_ICP.bin")
Powered by Phoca Download