Pedro77
Pedro77

Reputation: 5294

Matlab plane fit - unable to get the root mean square error

I need to find the RMS (root mean square) error of a plane fit to a set of 3D points. I'm using the pcfitplane function, but I'm getting an array of indexes as result.

My code:

% Create the point cloud object
% XYZ is a N by 3 matrix containing the points
ptCloud = pointCloud(XYZ);
[~,rmse] = pcfitplane(ptCloud,maxDistance);

% rmse is a 1 by N array, and the values are also from 1 to N! 

What I'm missing here? How can I get the RMS error correctly?

Upvotes: 1

Views: 856

Answers (1)

Mad Physicist
Mad Physicist

Reputation: 114488

You are not interpreting the docs correctly. Here is how the prototypes are shown:

[model,inlierIndices,outlierIndices] = pcfitplane(ptCloudIn,maxDistance)
[___,rmse] = pcfitplane(ptCloudIn,maxDistance)
[___] = pcfitplane(ptCloudIn,maxDistance,Name,Value)

The long triple underscore means "all the output arguments from the sytaxes shown above", not "one argument". As you correctly noticed, you are getting the inlierIndices back. You are trying to do something like this:

[~,~,~,rmse] = pcfitplane(ptCloud,maxDistance);

The three tildes are the long underscore. They represent model,inlierIndices,outlierIndices. Hope that helps you with future docs as well.

Upvotes: 1

Related Questions