// Calculate the Count lines in the image with most points.
    private HougLine[] GetTop(int count)
    {
        HougLine[] hl = new HougLine[count];

        for (int i = 0; i <= count - 1; i++)
        {
            hl[i] = new HougLine();
        }
        for (int i = 0; i <= _hMatrix.Length - 1; i++)
        {
            if (_hMatrix[i] > hl[count - 1].Count)
            {
                hl[count - 1].Count = _hMatrix[i];
                hl[count - 1].Index = i;
                int j = count - 1;
                while (j > 0 && hl[j].Count > hl[j - 1].Count)
                {
                    HougLine tmp = hl[j];
                    hl[j]     = hl[j - 1];
                    hl[j - 1] = tmp;
                    j        -= 1;
                }
            }
        }

        for (int i = 0; i <= count - 1; i++)
        {
            int dIndex     = hl[i].Index / STEPS;
            int alphaIndex = hl[i].Index - dIndex * STEPS;
            hl[i].Alpha = GetAlpha(alphaIndex);
            //hl[i].D = dIndex + _min;
        }

        return(hl);
    }
示例#2
0
 // Calculate the Count lines in the image with most points.
 private HougLine[] GetTop(int count)
 {
     var hl = new HougLine[count];
     int i;
     for (i = 0; i <= count - 1; i++)
     {
         hl[i] = new HougLine();
     }
     for (i = 0; i <= _hMatrix.Length - 1; i++)
     {
         if (_hMatrix[i] <= hl[count - 1].Count)
             continue;
         hl[count - 1].Count = _hMatrix[i];
         hl[count - 1].Index = i;
         int j = count - 1;
         while (j > 0 && hl[j].Count > hl[j - 1].Count)
         {
             HougLine tmp = hl[j];
             hl[j] = hl[j - 1];
             hl[j - 1] = tmp;
             j -= 1;
         }
     }
     for (i = 0; i <= count - 1; i++)
     {
         int dIndex = hl[i].Index / Steps;
         int alphaIndex = hl[i].Index - dIndex * Steps;
         hl[i].Alpha = GetAlpha(alphaIndex);
     }
     return hl;
 }
示例#3
0
        // Calculate the Count lines in the image with most points.
        private HougLine[] GetTop(int count)
        {
            var hl = new HougLine[count];
            int i;

            for (i = 0; i <= count - 1; i++)
            {
                hl[i] = new HougLine();
            }
            for (i = 0; i <= _hMatrix.Length - 1; i++)
            {
                if (_hMatrix[i] <= hl[count - 1].Count)
                {
                    continue;
                }
                hl[count - 1].Count = _hMatrix[i];
                hl[count - 1].Index = i;
                int j = count - 1;
                while (j > 0 && hl[j].Count > hl[j - 1].Count)
                {
                    HougLine tmp = hl[j];
                    hl[j]     = hl[j - 1];
                    hl[j - 1] = tmp;
                    j        -= 1;
                }
            }
            for (i = 0; i <= count - 1; i++)
            {
                int dIndex     = hl[i].Index / Steps;
                int alphaIndex = hl[i].Index - dIndex * Steps;
                hl[i].Alpha = GetAlpha(alphaIndex);
            }
            return(hl);
        }
示例#4
0
        // Calculate the Count lines in the image with most points.
        private HougLine[] GetTop(int Count)
        {
            HougLine[] hl;
            int        i;
            int        j;
            HougLine   tmp;
            int        AlphaIndex;
            int        dIndex;

            hl = new HougLine[Count + 1];
            for (i = 0; i <= Count - 1; i++)
            {
                hl[i] = new HougLine();
            }
            for (i = 0; i <= cHMatrix.Length - 1; i++)
            {
                if (cHMatrix[i] > hl[Count - 1].Count)
                {
                    hl[Count - 1].Count = cHMatrix[i];
                    hl[Count - 1].Index = i;
                    j = Count - 1;
                    while (j > 0 && hl[j].Count > hl[j - 1].Count)
                    {
                        tmp       = hl[j];
                        hl[j]     = hl[j - 1];
                        hl[j - 1] = tmp;
                        j        -= 1;
                    }
                }
            }
            for (i = 0; i <= Count - 1; i++)
            {
                dIndex      = hl[i].Index / cSteps;
                AlphaIndex  = hl[i].Index - dIndex * cSteps;
                hl[i].Alpha = GetAlpha(AlphaIndex);
                hl[i].d     = dIndex + cDMin;
            }
            return(hl);
        }
示例#5
0
        // Calculate the Count lines in the image with most points.    
        private HougLine[] GetTop(int Count)
        {
            HougLine[] hl = new HougLine[Count];
            for (int i = 0; i < Count; i++)
            {
                hl[i] = new HougLine();
            }

            HougLine tmp;

            for (int i = 0; i < cHMatrix.Length - 1; i++)
            {
                if (cHMatrix[i] > hl[Count - 1].Count)
                {
                    hl[Count - 1].Count = cHMatrix[i];
                    hl[Count - 1].Index = i;
                    int j = Count - 1;
                    while (j > 0 && hl[j].Count > hl[j - 1].Count)
                    {
                        tmp = hl[j];
                        hl[j] = hl[j - 1];
                        hl[j - 1] = tmp;
                        j--;
                    }
                }
            }

            int AlphaIndex, dIndex;

            for (int i = 0; i < Count; i++)
            {
                dIndex = hl[i].Index / cSteps;
                AlphaIndex = hl[i].Index - dIndex * cSteps;
                hl[i].Alpha = GetAlpha(AlphaIndex);
                hl[i].d = dIndex + cDMin;
            }
            return hl;
        }
示例#6
0
        // Calculate the Count lines in the image with most points.
        private HougLine[] GetTop(int count)
        {
            HougLine[] hl = new HougLine[count];

            for (int i = 0; i <= count - 1; i++)
            {
                hl[i] = new HougLine();
            }
            for (int i = 0; i <= _hMatrix.Length - 1; i++)
            {
                if (_hMatrix[i] > hl[count - 1].Count)
                {
                    hl[count - 1].Count = _hMatrix[i];
                    hl[count - 1].Index = i;
                    int j = count - 1;
                    while (j > 0 && hl[j].Count > hl[j - 1].Count)
                    {
                        HougLine tmp = hl[j];
                        hl[j] = hl[j - 1];
                        hl[j - 1] = tmp;
                        j -= 1;
                    }
                }
            }

            for (int i = 0; i <= count - 1; i++)
            {
                int dIndex = hl[i].Index / STEPS;
                int alphaIndex = hl[i].Index - dIndex * STEPS;
                hl[i].Alpha = GetAlpha(alphaIndex);
                //hl[i].D = dIndex + _min;
            }

            return hl;
        }