minboundcircle stuck in infinate loop of a particular dataset

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

 Réponse acceptée

Thorsten
Thorsten le 2 Déc 2014
Modifié(e) : Thorsten le 2 Déc 2014
I cannot replicate your error but get
minboundcircle(X89,Y89)
ans =
471.8077 261.8077

5 commentaires

Thorsten... Thanks. I tried again, just with the minboundcircle(X89,Y89) from the command line and still get the loop and have to terminate with Ctrl-C. Perhaps this is a version issue... what version are you using?
Here is my output...
ans =
X: [181x1 double]
Y: [181x1 double]
ans =
X: [181x1 double]
Y: [181x1 double]
>> minboundcircle(X88,Y88)
ans =
471.7500 262.0000
>> minboundcircle(X89,Y89) Operation terminated by user during minboundcircle (line 129)
>>
Thorsten
Thorsten le 2 Déc 2014
Modifié(e) : Thorsten le 2 Déc 2014
Works for me both on R2012a on MacOSX and R2007b on Win XP. It might be a version issue. Or you might have re-defined one of Matlab's standard function in one of your (sub)folders.
If I put
disp([rmax radius])
before line 163
if (rmax - radius) <= tol
I get
Run 88
12.6491 5.3852
7.6135 7.4771
7.5208 7.5208
Run 89
12.9808 4.7434
7.6879 7.4520
7.6259 7.4788
7.5190 7.5190
What do you get?
Thorsten... Thanks for digging deeper.
For run 88, I get...
12.6491 5.3852
7.6135 7.4771
7.5208 7.5208
For run 89, i get:
13.3417 4.1231
7.6879 7.4520
7.6259 7.4788
7.5190 7.5190
7.5190 7.5190
7.5190 7.5190
7.5190 7.5190
7.5190 7.5190
7.5190 7.5190
7.5190 7.5190
7.5190 7.5190
7.5190 7.5190
7.5190 7.5190
7.5190 7.5190
7.5190 7.5190
7.5190 7.5190
7.5190 7.5190
7.5190 7.5190
7.5190 7.5190
7.5190 7.5190
7.5190 7.5190
... over and over again until I halt the code execution.
What is most interesting to me is that my line:
if (rmax - radius) <= tol
is line number 131. Perhaps I have an older version of minboundcircle. Any chance you could check against this header information?
% Author: John D'Errico
% Release: 1.0
% Release date: 1/10/07
Thanks again!
Tony
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
Cool that you have traced the error. I'm happy that I could give some help.
Best, Thorsten

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by