\scriptsize{
\begin{flushleft}


{\bfseries ALGORITHM for bounding box determination}\\
\bigskip
\bigskip
{\bfseries Input:} interest point inside particle\\
\bigskip
{\bfseries DO:}
\begin{enumerate}
\item consider 150 pixel values starting from your interest point in direction: N, S, E, W, NW, NE, SE, SW; you will have 8 vectors $V_1 \dots V_8$
\item group the pixel values in each vector in set of three and compute their mean; you will have 8 vectors $v_1 \dots v_8$, each with 50 items
\item for each vector $v_i$, estimate the background brightness in that direction looking at the peak of the histogram of values contained in $v_i$
\item the border of the object is found when the mean squared error of 4 consecutive values in $v_i$ with respect to the background brightness is less than a
certain threshold; you will get 8 points around your interest point
\item fit a circle taking three points and try many combinations (i.e. points in N-NE-E, N-SW-E, etc.) 
\item the optimal bounding circle is the one with minimum error $e$; for each estimated circle, we compute the distances of the points not involved in the estimation (that are 5) 
to the circumference and we define $e$ as the sum of the three smallest distances
\item we take the center of the circle as centroid and its diameter as side of a square bounding box.
\end{enumerate}  

\bigskip
{\bfseries Output:} bounding box
 
 
\end{flushleft} 
}
