Accord.Imaging.HoughCircleTransformation.CollectCircles C# (CSharp) Method

CollectCircles() private method

private CollectCircles ( ) : void
return void
        private void CollectCircles()
        {
            short intensity;
            bool foundGreater;

            // clean circles collection
            circles.Clear();

            // for each Y coordinate
            for (int y = 0; y < height; y++)
            {
                // for each X coordinate
                for (int x = 0; x < width; x++)
                {
                    // get current value
                    intensity = houghMap[y, x];

                    if (intensity < minCircleIntensity)
                        continue;

                    foundGreater = false;

                    // check neighboors
                    for (int ty = y - localPeakRadius, tyMax = y + localPeakRadius; ty < tyMax; ty++)
                    {
                        // continue if the coordinate is out of map
                        if (ty < 0)
                            continue;
                        // break if it is not local maximum or coordinate is out of map
                        if ((foundGreater == true) || (ty >= height))
                            break;

                        for (int tx = x - localPeakRadius, txMax = x + localPeakRadius; tx < txMax; tx++)
                        {
                            // continue or break if the coordinate is out of map
                            if (tx < 0)
                                continue;
                            if (tx >= width)
                                break;

                            // compare the neighboor with current value
                            if (houghMap[ty, tx] > intensity)
                            {
                                foundGreater = true;
                                break;
                            }
                        }
                    }

                    // was it local maximum ?
                    if (!foundGreater)
                    {
                        // we have local maximum
                        circles.Add(new HoughCircle(x, y, radiusToDetect, intensity, (double)intensity / maxMapIntensity));
                    }
                }
            }

            circles.Sort();
        }