You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// cout<<"Particles found at position : "<<i<<" "<<j<<endl;
93
-
int partial_count=1;
94
-
int current_partial=0;
95
-
// cout<<"P1 "<<points.size()<<" ";
88
+
float val = ptr[i * elem_step + j]; //value of the current pixel
89
+
90
+
if (val!=0) //value above threshold: the edge of a particle! (top edge) We will check all its neighbor for other non black pixels (part of the particle) and will
91
+
{ //do that recursively for all non-0 pixels until the whole particle is detected…
92
+
int partial_count=1; //number of pixels positively detected
93
+
int current_partial=0; //number of pixels for which all neighbors have been checked
96
94
points.push_back(Points(i,j));
97
-
// cout<<"P2 "<<points.size()<<endl;
98
-
ptr[i*elem_step+j]=0;
99
-
// cout<<"P3 "<<points.size()<<endl;
95
+
ptr[i*elem_step+j]=0; //we put the value to zero for the pixel not to be detected again by the algorithm /!\ This is changing the output image /!\
100
96
101
97
unsignedint _i=i, _j=j;
102
-
while(current_partial<partial_count)
98
+
while(current_partial<partial_count)
103
99
{
104
-
105
-
// cout<<partial_count<<" count="<<count<<" current_partial="<<current_partial<<" partial count="<<partial_count<<" point size="<<points.size()<<endl;
0 commit comments