minboundcircle stuck in infinate loop of a particular dataset

6 views (last 30 days)
Hello. I have a dataset which represents the pixels of the center of a wheel identified from a single video frame. In my specific case, I have used minboundcircle to analyze 32,800 frames and only one seems to get stuck in an infinate loop. The problem frame has been identified as frame 89. I have attached the pixel dataset for the problem frame as well as the frame before it, frame 88. Both datasets contain 181 pixles of information and between the two dataset, only two points differ. Any ideas why frame 89 causes minboundcircle (specifically enc3 inside of minboundcircle) to get stuck?
Attached are 3 files: example88.mat - contains a dataset that works fine example89.mat - contains the problem dataset ProblemFrame.m - contains the code being used to call minboundcircle on each dataset (By commenting out line 23 and running, the code executes fully. Removing the comment and rerunning results in an infinate loop.)
FYI, minboundcircle.m came from the File Exchange. enc3.m is called from within minboundcircle.
My installation is: R2013a (8.1.0.604) 64-bin (win64)
Thanks,
Tony

Accepted Answer

Thorsten
Thorsten on 2 Dec 2014
Edited: Thorsten on 2 Dec 2014
I cannot replicate your error but get
minboundcircle(X89,Y89)
ans =
471.8077 261.8077
  5 Comments
Tony Beall
Tony Beall on 2 Dec 2014
Problem solved. I copied an updated version of minboundcircle.m down from the FileExchange and even though the header information suggests that it is the same revision (rev 1.0 1/10/07) it is different.
The code block around line 121:
% Keep a list of old sets as tried to trap any cycles. we don't need to
% retain a huge list of sets, but only a few of the best ones. Any cycle
% must hit one of these sets. Really, I could have used a smaller list,
% but this is a small enough size that who cares? Almost always we will
% never even fill up this list anyway.
old.sets = NaN(10,3);
old.rads = inf(10,1);
old.centers = NaN(10,2);
... is new
also, the entire while loop has been rewritten to include trapping for a cycle, such as the one I encountered...
while flag
% have we seen this set before? If so, then we have entered a cycle
Thanks for helping me get a resolution!
Tony
Thorsten
Thorsten on 2 Dec 2014
Cool that you have traced the error. I'm happy that I could give some help.
Best, Thorsten

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!