pcfitcylinder giving different answers

8 ビュー (過去 30 日間)
Karen Kruger
Karen Kruger 2017 年 10 月 4 日
コメント済み: Tim McKinley 2019 年 7 月 8 日
I'm using pcfitcylinder to calculate a best fit cylinder to a point cloud. The code is giving me different solutions when I run the function for the same data. Is this a bug in the code? I need a function that will give me reliable answers.

回答 (2 件)

Jyotish Robin
Jyotish Robin 2017 年 10 月 9 日
Hi Karen!
I understand that you are getting different results each time when you run the "pcfitcylinder" command. This behavior is due to the use of MSAC, a version or RANSAC algorithm. This algorithm is used inside the estimateEssentialMatrix that's part of the helperEstimateRelativePose.m file.
RANSAC uses a random process to initialize computation of a mathematical model, in this case an essential matrix, and to remove outliers from the data. This is expected behavior. It's the nature of this approach.
For debugging purpose, you can set the random seed before the "pcfitcylinder" command to get a deterministic result using the following command:
>> rng(0);
Hope this helps!
Regards ,
Jyotish
  1 件のコメント
Tim McKinley
Tim McKinley 2019 年 7 月 8 日
Hi Jyotish,
I ran into the same problem as Karen and upon following your suggest I still seem to get various fits to the data. I read that RANSAC utilizes a random sample size as well and wondered if that would be causing the solution variability.
Are you aware of a way to fix the sample size RANSAC is using or how to fix additional variable that the solver is using (beside the few listed in the pcfitcylinder documentation) to force the exact same number of points and seed point?
Thanks

サインインしてコメントする。


Daniel Fiole
Daniel Fiole 2018 年 5 月 18 日
Hi Karen,
Have you tried increasing the value of 'MaxNumTrials'?
Cheers, Daniel

Community Treasure Hunt

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

Start Hunting!

Translated by