private void findPucks(VerticalIntensityStatistics[] hist)
        {
            // Find all the pucks

            /* Thinking for this:
             *  - Choose your color and figure out how many pucks we've found
             *    - Scan through all the lines and find all objects larger than the min puck height
             *    - Compare each item
             */

            for (int i = 0; i < 5; i++)
            {
                List <puck> found_pucks = new List <puck>();
                int         cur_line    = hist[i].Gray.Values.Length - 1;
                int         puck_start  = -1;

                while (cur_line > 0)
                {
                    if (hist[i].Gray.Values[cur_line] > THRESHOLD)
                    {
                        if (puck_start < 0)
                        {
                            puck_start = cur_line;
                        }
                    }
                    else
                    {
                        if (puck_start > 0)
                        {
                            if (cur_line == 0 || hist[i].Gray.Values[cur_line - 1] < THRESHOLD)
                            {
                                int height = puck_start - cur_line;
                                if (height > MIN_PUCK_SIZE)
                                {
                                    puck p = new puck();
                                    p.location = puck_start;
                                    p.height   = height;
                                    found_pucks.Add(p);
                                }
                                puck_start = -1;
                            }
                        }
                    }
                    cur_line--;
                }

                if (i == 0)
                {
                    s += "Found " + found_pucks.Count + " Pucks: ";
                    foreach (puck p in found_pucks)
                    {
                        s += "(" + p.location + "/" + p.height + ") ";
                    }
                    s += "\r\n";
                }
            }
        }
        private void findPucks(VerticalIntensityStatistics[] hist)
        {
            // Find all the pucks
            /* Thinking for this:
             *  - Choose your color and figure out how many pucks we've found
             *    - Scan through all the lines and find all objects larger than the min puck height
             *    - Compare each item
             */

            for (int i = 0; i < 5; i++)
            {
                List<puck> found_pucks = new List<puck>();
                int cur_line = hist[i].Gray.Values.Length - 1;
                int puck_start = -1;

                while (cur_line > 0)
                {
                    if (hist[i].Gray.Values[cur_line] > THRESHOLD)
                    {
                        if (puck_start < 0)
                        {
                            puck_start = cur_line;
                        }
                    }
                    else
                    {
                        if (puck_start > 0)
                        {
                            if (cur_line == 0 || hist[i].Gray.Values[cur_line - 1] < THRESHOLD)
                            {
                                int height = puck_start - cur_line;
                                if (height > MIN_PUCK_SIZE)
                                {
                                    puck p = new puck();
                                    p.location = puck_start;
                                    p.height = height;
                                    found_pucks.Add(p);
                                }
                                puck_start = -1;
                            }
                        }
                    }
                    cur_line--;
                }

                if (i == 0) {
                    s += "Found " + found_pucks.Count + " Pucks: ";
                    foreach (puck p in found_pucks)
                    {
                        s += "(" + p.location + "/" + p.height + ") ";
                    }
                    s += "\r\n";
                }
            }
        }