예제 #1
0
    def __init__(self, bound, id, layer, parent_id):
        col_min, row_min, col_max, row_max = bound
        self.bbox = Bbox(col_min, row_min, col_max, row_max)

        self.id = id
        self.layer = layer
        self.parent_id = parent_id
예제 #2
0
class Block:
    def __init__(self, bound, id, layer, parent_id):
        col_min, row_min, col_max, row_max = bound
        self.bbox = Bbox(col_min, row_min, col_max, row_max)

        self.id = id
        self.layer = layer
        self.parent_id = parent_id

    def put_bbox(self):
        return self.bbox.put_bbox()

    def relation(self, bound):
        '''
        relation: -1 : a in b
                  0  : a, b are not intersected
                  1  : b in a
                  2  : a, b are identical or intersected
        '''
        col_min, row_min, col_max, row_max = bound
        bbox = Bbox(col_min, row_min, col_max, row_max)
        return self.bbox.bbox_relation_nms(bbox)

    def resize_bbox(self, det_height, tgt_height, bias):
        col_min, row_min, col_max, row_max = self.bbox.put_bbox()
        scale = tgt_height / det_height
        self.bbox = Bbox(
            int(col_min * scale) + bias,
            int(row_min * scale) + bias,
            int(col_max * scale) - bias,
            int(row_max * scale) - bias)
예제 #3
0
 def resize_bbox(self, det_height, tgt_height, bias):
     col_min, row_min, col_max, row_max = self.bbox.put_bbox()
     scale = tgt_height / det_height
     self.bbox = Bbox(
         int(col_min * scale) + bias,
         int(row_min * scale) + bias,
         int(col_max * scale) - bias,
         int(row_max * scale) - bias)
예제 #4
0
 def relation(self, bound):
     '''
     relation: -1 : a in b
               0  : a, b are not intersected
               1  : b in a
               2  : a, b are identical or intersected
     '''
     col_min, row_min, col_max, row_max = bound
     bbox = Bbox(col_min, row_min, col_max, row_max)
     return self.bbox.bbox_relation_nms(bbox)
예제 #5
0
class Block:
    def __init__(self, bound, id, layer, parent_id):
        col_min, row_min, col_max, row_max = bound
        self.bbox = Bbox(col_min, row_min, col_max, row_max)

        self.id = id
        self.layer = layer
        self.parent_id = parent_id

    def put_bbox(self):
        return self.bbox.put_bbox()

    def relation(self, bound):
        '''
        relation: -1 : a in b
                  0  : a, b are not intersected
                  1  : b in a
                  2  : a, b are intersected
                  3  : a, b are same
        '''
        col_min, row_min, col_max, row_max = bound
        bbox = Bbox(col_min, row_min, col_max, row_max)
        return self.bbox.bbox_relation_nms(bbox)

    def resize_bbox(self, det_height, tgt_height, bias):
        col_min, row_min, col_max, row_max = self.bbox.put_bbox()
        scale = tgt_height / det_height
        self.bbox = Bbox(
            int(col_min * scale) + bias,
            int(row_min * scale) + bias,
            int(col_max * scale) - bias,
            int(row_max * scale) - bias)

    def is_bottom_or_top_bar(self, img_height=800):
        column_min, row_min, column_max, row_max = self.bbox.put_bbox()
        if row_max < img_height * 0.06 or row_min > img_height * 0.9:
            return True
        return False
예제 #6
0
파일: Component.py 프로젝트: thorxx/UIED
 def compo_get_bbox(self):
     """
     Get the top left and bottom right points of boundary
     :param boundaries: boundary: [top, bottom, left, right]
                         -> up, bottom: (column_index, min/max row border)
                         -> left, right: (row_index, min/max column border) detect range of each row
     :return: corners: [(top_left, bottom_right)]
                         -> top_left: (column_min, row_min)
                         -> bottom_right: (column_max, row_max)
     """
     col_min, row_min = (int(min(self.boundary[0][0][0], self.boundary[1][-1][0])), int(min(self.boundary[2][0][0], self.boundary[3][-1][0])))
     col_max, row_max = (int(max(self.boundary[0][0][0], self.boundary[1][-1][0])), int(max(self.boundary[2][0][0], self.boundary[3][-1][0])))
     bbox = Bbox(col_min, row_min, col_max, row_max)
     return bbox