Esempio n. 1
0
 def aspect_ratio(component):
     copy = image.copy()
     points_in_region = MSER.extremal_region(component_to_points, component)
     num_rows, num_cols = np.shape(copy)
     min_row = num_rows
     max_row = 0
     min_col = num_cols
     max_col = 0
     for point in points_in_region:
         if point.row < min_row:
             min_row = point.row
         elif point.row > max_row:
             max_row = point.row
         if point.col < min_col:
             min_col = point.col
         elif point.col > max_col:
             max_col = point.col
     width, height = (max_row-min_row) , (max_col-min_col)
     if width > 0 and height>0:
         return float(width)/height
     return None
Esempio n. 2
0
 def aspect_ratio(component):
     copy = image.copy()
     points_in_region = MSER.extremal_region(component_to_points,
                                             component)
     num_rows, num_cols = np.shape(copy)
     min_row = num_rows
     max_row = 0
     min_col = num_cols
     max_col = 0
     for point in points_in_region:
         if point.row < min_row:
             min_row = point.row
         elif point.row > max_row:
             max_row = point.row
         if point.col < min_col:
             min_col = point.col
         elif point.col > max_col:
             max_col = point.col
     width, height = (max_row - min_row), (max_col - min_col)
     if width > 0 and height > 0:
         return float(width) / height
     return None
Esempio n. 3
0
 def size(component):
     return len(MSER.extremal_region(component_to_points, component))
Esempio n. 4
0
 def difference(component1, component2):
     return MSER.extremal_region(
         component_to_points, component1).difference(
             MSER.extremal_region(component_to_points, component2))
Esempio n. 5
0
 def size(component):
     return len(MSER.extremal_region(component_to_points, component))
Esempio n. 6
0
 def difference(component1, component2):
     return MSER.extremal_region(component_to_points, component1).difference(MSER.extremal_region(component_to_points, component2))