What is the functionality of the distance evaluation function in the RANSAC MATLAB function?

4 次查看(过去 30 天)
Dear all,
I have used the RANSAC Matlab function for computing inlier points of the data. Can anyone please tell me the functionality of "distFcn" in the input argument of ransac?
Is the functionality of the distance evaluation function is a euclidean distance?
The following things mentioned with the help of RANSAC.
[model,inlierIdx] = ransac(data,fitFcn,distFcn,sampleSize,maxDistance)
sampleSize = 2; % number of points to sample per trial
maxDistance = 2; % max allowable distance for inliers
fitLineFcn = @(points) polyfit(points(:,1),points(:,2),1); % fit function using polyfit
evalLineFcn = ... % distance evaluation function
@(model, points) sum((points(:, 2) - polyval(model, points(:,1))).^2,2);
[modelRANSAC, inlierIdx] = ransac(points,fitLineFcn,evalLineFcn, sampleSize,maxDistance);
distFcn — Function to compute distances from model:
Function to compute distances from the model to the data, specified as a function handle. The function must be of the form: distances = distFcn(model,data)
If model is an n-element array, then distances must be an m-by-n matrix. Otherwise, distances must be an m-by-1 vector.
Thanks & regards
Sukumar.

采纳的回答

Walter Roberson
Walter Roberson 2021-7-13
The function that you post uses Euclidean distance. The people who designed ransac did not want to restrict to Euclidean in case someone had a need for a different distance measure. See the documentation for pdist() for examples of other distance functions that are possible (in a general sense.)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Model Building and Assessment 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by