forked from jekollmer/PEGS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PeGSHoughDebug.m
45 lines (41 loc) · 1.69 KB
/
PeGSHoughDebug.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
function [SL, SS] = PeGSHoughDebug(Rimg, Rlarge, SL, Rsmall, SS, DS, NlargeExp, NsmallExp)
%UNTITLED6 Summary of this function goes here
% Detailed explanation goes here
Rose = 0;
Nlarge = 0;
while Nlarge ~= NlargeExp
[centers, ~, ~] = imfindcircles(Rimg,Rlarge,'ObjectPolarity','bright','Method','TwoStage','Sensitivity',SL);
Nlarge = length(centers);
particle(1:Nlarge) = struct('id',0,'x',0,'y',0,'r',0,'rm',0,'metric',0,'color','','fsigma',0,'z',0,'f',0,'g2',0,'forces',[],'betas',[],'alphas',[],'neighbours',[],'contactG2s',[],'forceImage',[]);
if Nlarge > NlargeExp
if Rose == 1 % Rose Variable used to prevent infinite loop
break
end
SL = SL - DS;
fprintf('Too many large particles, lowering SL\n');
elseif Nlarge < NlargeExp
SL = SL + DS;
fprintf('Not enough large particles, raising SL\n');
Rose = 1;
end
end
Rose = 0;
Nsmall = 0;
while Nsmall ~= NsmallExp
[centers, ~, ~] = imfindcircles(Rimg,Rsmall,'ObjectPolarity','bright','Method','TwoStage','Sensitivity',SS);
Nsmall = length(centers);
N = Nsmall + Nlarge;
particle(Nlarge+1:N) = struct('id',0,'x',0,'y',0,'r',0,'rm',0,'metric',0,'color','','fsigma',0,'z',0,'f',0,'g2',0,'forces',[],'betas',[],'alphas',[],'neighbours',[],'contactG2s',[],'forceImage',[]);
if Nsmall > NsmallExp
if Rose == 1 % Rose variable used to prevent infinite loop
break
end
SS = SS - DS;
fprintf('Too many small particles, lowering SS\n');
elseif Nsmall < NsmallExp
SS = SS + DS;
fprintf('Not enough small particles, raising SS\n');
Rose = 1;
end
end
end