# How to change the orientation of an object w.r.t a scene?

I am trying to localize an object in a point cloud using ROS, PCL. For that I capture the scene and model using Asus xtion pro sensor. I use RGBDSLAMv2 for capturing the model.

Then I use ICP (nonlinear version) to find the transform from the model to each cluster of the cloud. The cluster with the lowest score is chosen as the best matching cluster.

Pseudocode:

Segment the point cloud into different clusters. ([Using euclidean clustering][3])
for each cluster i
Source: 3dmodel. Target: current cluster
Perform [ICP (nonlinear version)][2].
score[i] = icp.getFitnessScore()
T[i] = icp.getFinalTransformation()
end for
matchingCluster = cluster with minimum score
finalT = T[matchingCluster]


However, I am not able to find the correct transformation.

Here are the screenshots of the results I got:

The red colored object is the transformed model overlayed onto the scene. The yellow object represents the original model in the coordinate system of the scene.

Now, my concern is why there is no proper transformation? Am I missing something?

Second, I see that the object model and scene are in different coordinate system. So the model appears inverted when presented in the scene's coordinate system. Is there a way in which I can transform the model upright before running ICP?

Thanks :)

• Can you provide some pseudo code, or the math involved? I'd guess that the problem could be with how poses are represented. Are they relative? or is there a single global coordinate system? The problem could also be with the display code. Is there an opengl transformation causing the inverted display? – bendervader Oct 28 '14 at 8:59
• @bendervader, I added a psuedo code to explain how I am running ICP. As you can see the two clouds are in different coordinate frames. So when I concatenate the clouds, the points of model(in yellow) are represented in the coordinate system of the scene. Thats why it appears inverted ( I cannot say anything about opengl transformation..) Is there any way to find the transfomration b/w camera poses and apply it before applying ICP? – Swagatika Oct 28 '14 at 21:04