[vtkusers] How to bring an object to the coordinate's origin

nuno.jf nunofernandes7 at gmail.com
Fri Mar 25 08:20:37 EDT 2011


Wes, 

Thank you very much for your answer, but unfortunately I don't know how to
do what you suggested me.
How do I turn off ICP initialization, or chose the partial clouds as the
source points? 
Is this it? -> icp -> StartByMatchingCentroidsOff();

Is there any example for me to see? Sorry for all of this questions, I am
still a newbie in this field.
This is how my code:

	// Rigid Transform
	//---------------------------------------------------------
	vtkTransformPolyDataFilter *TF = vtkTransformPolyDataFilter::New(); 
	vtkTransform *ActualPosition = vtkTransform::New(); 

	int n;
	n= 5* 7* (360/290);
	ActualPosition -> Identity();
	ActualPosition -> PostMultiply();
	ActualPosition -> Translate( 0, 0, -875);			
	ActualPosition -> RotateY(n );			
	ActualPosition -> Translate( 0, 0,  875);			

	TF -> SetInput( polyData2 ); 
	TF -> SetTransform( ActualPosition );
	TF -> Update(); 
	
		
	// ICP 
	//---------------------------------------------------------
	
	vtkIterativeClosestPointTransform * icp =
vtkIterativeClosestPointTransform::New();

	// Set SOURCE and TARGET points

	icp -> SetTarget( polyData1 );
	icp -> SetSource( TF ->GetOutput() ); 
	
	
	// Configure ICP transform
	//---------------------------------------------------------		
	
	icp -> SetMaximumNumberOfIterations( 100 );	
	icp -> SetMaximumNumberOfLandmarks( 10000 ); 
	icp -> StartByMatchingCentroidsOff();
	icp -> GetLandmarkTransform()->SetModeToRigidBody();
	icp -> SetMeanDistanceModeToRMS();
	icp -> SetMaximumMeanDistance(0.000001);
	icp -> Update();

	std::cout << "ICP Mean Distance RMS = " << icp -> GetMeanDistance() <<
std::endl;

	// transform SOURCE to obtain TARGET
	//---------------------------------------------------------
	vtkTransformPolyDataFilter * transform = vtkTransformPolyDataFilter::New();
	
	transform -> SetTransform( icp );
	transform -> SetInput( TF->GetOutput());
	transform -> Update();
	
	
	std::cout << "ICP transform done." << std::endl;   

Could you indicate my, by seeing this, what should I do? 

--
View this message in context: http://vtk.1045678.n5.nabble.com/How-to-bring-an-object-to-the-coordinate-s-origin-tp4243261p4263986.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list