public void groupTexts(double threshold) {
      //ArrayList<RegionGroup> textgroup = new ArrayList<RegionGroup>();
      int group = 0;
      double dist = 0;
      for (RegionInfo r1 : this.blackRegions) {
         if (r1.type == 1) {
            if (r1.textGroup == -1) {
               r1.textGroup = group;
               this.textgroup.add(new RegionGroup(group, r1));
               group++;
            }
       
            for (RegionInfo r2 : this.blackRegions) {
               if (r2.type == 1) {
                  if ((r1 != r2) && (distance(r1, r2) <= threshold)) {
                     join(r1, r2, this.textgroup);
                  }
               }
            }
         }
      }
      analyzeTextgroup(this.textgroup);
   }