First complete draft
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
\section{Ball detection}
|
||||
\section{Ball Detection}
|
||||
\label{p sec ball detection}
|
||||
|
||||
The very first task that needed to be accomplished was to detect the ball,
|
||||
@@ -6,13 +6,13 @@ which is uniformly red-colored and measures about 6 cm in diameter. We decided
|
||||
to use a popular algorithm based on color segmentation \cite{ball-detect}. The
|
||||
idea behind this algorithm is to find the biggest red area in the image and
|
||||
assume that this is the ball. First, the desired color needs to be defined as
|
||||
an interval of HSV (Hue-Saturation-Value) values. After that, the image itself
|
||||
needs to be transformed into HSV colorspace, so that the regions of interest
|
||||
can be extracted into a \textit{binary mask}. The contours of the regions can
|
||||
then be identified in a mask \cite{contours}, and the areas of the regions can
|
||||
be calculated using the routines from the OpenCV library. The center and the
|
||||
radius of the region with the largest area are then determined and are assumed
|
||||
to be the center and the radius of the ball.
|
||||
an interval of HSV (Hue-Saturation-Value) \cite{hsv} values. After that, the
|
||||
image itself needs to be transformed into HSV colorspace, so that the regions
|
||||
of interest can be extracted into a \textit{binary mask}. The contours of the
|
||||
regions can then be identified in a mask \cite{contours}, and the areas of the
|
||||
regions can be calculated using the routines from the OpenCV library. The
|
||||
center and the radius of the region with the largest area are then determined
|
||||
and are assumed to be the center and the radius of the ball.
|
||||
|
||||
\begin{figure}[ht]
|
||||
\includegraphics[width=\textwidth]{\fig ball-detection}
|
||||
@@ -24,10 +24,10 @@ It is sometimes recommended \cite{ball-detect} to eliminate the noise in the
|
||||
binary mask by applying a sequence of \textit{erosions} and \textit{dilations},
|
||||
but we found, that for the task of finding the \textit{biggest} area the noise
|
||||
doesn't present a problem, whereas performing erosions may completely delete
|
||||
the image of the ball, if it is relatively far from the robot and the camera
|
||||
resolution is low. For this reason it was decided not to process the binary
|
||||
mask with erosions and dilations, which allowed us to detect the ball even over
|
||||
long distances.
|
||||
the image of the ball from the mask, if it is relatively far from the robot and
|
||||
the camera resolution is low. For this reason it was decided not to process the
|
||||
binary mask with erosions and dilations, which allowed us to detect the ball
|
||||
even over long distances.
|
||||
|
||||
The advantages of the presented algorithm are its speed and simplicity. The
|
||||
major downside is that the careful color calibration is required for the
|
||||
@@ -35,11 +35,11 @@ algorithm to function properly. If the HSV interval of the targeted color is
|
||||
too narrow, then the algorithm might miss the ball; if the interval is too
|
||||
wide, then other big red-shaded objects in the camera image will be detected as
|
||||
the ball. A possible approach to alleviate these issues to a certain degree
|
||||
will be presented further in this chapter. To conclude, we found this algorithm
|
||||
to be robust enough for our purposes, if the sensible color calibration was
|
||||
provided.
|
||||
will be presented further in the section \ref{p sec field detect}. To
|
||||
conclude, we found this algorithm to be robust enough for our purposes, if the
|
||||
sensible color calibration was provided.
|
||||
|
||||
\section{Goal detection}
|
||||
\section{Goal Detection}
|
||||
\label{p sec goal detect}
|
||||
|
||||
The goal detection presented itself as a more difficult task. The color of the
|
||||
@@ -51,9 +51,7 @@ propose the following heuristic algorithm.
|
||||
|
||||
\begin{figure}[ht]
|
||||
\includegraphics[width=\textwidth]{\fig goal-detection}
|
||||
\caption{Goal Detection. On the right binary mask with all found contours. On
|
||||
the left the goal, and one contour that passed preselection but was
|
||||
rejected during scoring.}
|
||||
\caption{Goal detection}
|
||||
\label{p figure goal-detection}
|
||||
\end{figure}
|
||||
|
||||
@@ -77,13 +75,13 @@ stage ends here, and the remaining candidates are passed to the scoring
|
||||
function.
|
||||
|
||||
The scoring function calculates, how different are the properties of the
|
||||
candidates are from the properties, an idealized goal contour is expected to
|
||||
have. The evaluation is happening based on two properties. The first property
|
||||
is based on the observation, that the area of the goal contour is much smaller
|
||||
than the area of its \textit{enclosing convex hull} \cite{convex-hull}. The
|
||||
second observation is that all points of the goal contour must lie close to the
|
||||
enclosing convex hull. The mathematical formulation can then look like the
|
||||
following:
|
||||
candidates are from the properties, that an idealized goal contour is expected
|
||||
to have. The evaluation is happening based on two properties. The first
|
||||
property is based on the observation, that the area of the goal contour is much
|
||||
smaller than the area of its \textit{enclosing convex hull} \cite{convex-hull}.
|
||||
The second observation is that all points of the goal contour must lie close to
|
||||
the enclosing convex hull. The mathematical formulation of a corresponding
|
||||
scoring function can then look like the following:
|
||||
|
||||
\begin{equation*}
|
||||
S(c)=\frac{A(c)}{A(Hull(c))}+\displaystyle\sum_{x_i \in c}\min_{h \in Hull(c)
|
||||
@@ -93,21 +91,25 @@ following:
|
||||
The contour, that minimizes the scoring function, while keeping its value under
|
||||
a certain threshold is considered the goal. If no contour scores below the
|
||||
threshold, then the algorithm assumes that no goal was found. An important note
|
||||
is that the algorithm in such a way, that the preselection and scoring are
|
||||
modular, which means that the current simple scoring function can later be
|
||||
replaced by a function with a better heuristic, or even by some function that
|
||||
employs machine learning models.
|
||||
is that the algorithm is designed in such a way, that the preselection and
|
||||
scoring are modular, which means that the current simple scoring function can
|
||||
later be replaced by a function with a better heuristic, or even by some
|
||||
function that employs machine learning models.
|
||||
|
||||
Our tests have shown, that when the white color is calibrated correctly, the
|
||||
algorithm can detect the goal almost without mistakes, when the goal is present
|
||||
in the image. Most irrelevant candidates candidates are normally discarded in
|
||||
the preselection stage, and the scoring function improves the robustness
|
||||
further. The downside of this algorithm, is that in some cases the field lines
|
||||
in the image. Most irrelevant candidates are normally discarded in the
|
||||
preselection stage, and the scoring function improves the robustness further.
|
||||
Figure \ref{p figure goal-detection} demonstrates the algorithm in action. On
|
||||
the right is the binary mask with all found contours. On the left are the goal,
|
||||
and one contour that passed preselection but was rejected during scoring.
|
||||
|
||||
One downside of this algorithm, is that in some cases the field lines
|
||||
might appear to have the same properties, that the goal contour is expected to
|
||||
have, therefore the field lines can be mistaken for the goal. We will describe,
|
||||
how we dealt with this problem, in the section \ref{p sec field detect}.
|
||||
|
||||
\section{Field detection}
|
||||
\section{Field Detection}
|
||||
\label{p sec field detect}
|
||||
|
||||
The algorithm for the field detection is very similar to the ball detection
|
||||
|
||||
Reference in New Issue
Block a user