Strabo.Core.TextDetection.TextString.Split C# (CSharp) Method

Split() private method

private Split ( int min_dist, int char_width, int labels, int label_width, int label_height, int smaller_angle_threshold, int larger_angle_threshold ) : void
min_dist int
char_width int
labels int
label_width int
label_height int
smaller_angle_threshold int
larger_angle_threshold int
return void
        private void Split(int min_dist, int char_width, int[] labels, int label_width, int label_height, int smaller_angle_threshold, int larger_angle_threshold)
        {
            this._smaller_angle_threshold = smaller_angle_threshold;
            this._larger_angle_threshold = larger_angle_threshold;

            int cc = 0;
            for (int i = 0; i < _char_list.Count; i++)
            {
                if (_char_list[i].bbx.Width < char_width / 2 && _char_list[i].bbx.Height < char_width / 2)
                    _char_list[i].sizefilter_included = false;
                else cc++;
            }
            // If the string has fewer than 3 CCs (non-small CCs), mark as "short string"
            if (cc <= 3) { Convert2FinalStringList(); return; }

            // Applying distance transformation (distance between characters)
            Connect(min_dist, char_width, labels, label_width, label_height);
            // Checking for "net" structure
            int connecting_node_count = 0;
            for (int i = 0; i < _char_list.Count; i++)
            {
                if (_char_list[i].neighbors.Count > 2)
                    connecting_node_count++;
                if (_debug)
                {
                    Console.Write("NE: " + i + "--- ");
                    for (int j = 0; j < _char_list[i].neighbors.Count; j++)
                        Console.Write(_char_list[i].neighbors[j] + " ");
                    Console.WriteLine();
                }
            }
            if (connecting_node_count > _char_list.Count / 2)
            { _net = true; Convert2FinalStringList(); return; }
            // If no character has more than 2 connections and any set of three connected characters constitutes an acute angle, send the string to break
            if (connecting_node_count == 0)
                BreakIt(smaller_angle_threshold); // loose threshold
            else
                SplitIt();
        }