(draw_obj, box, color, width, method)
use draw lines to draw rectangle. since the draw_rectangle func can not modify the width of rectangle
    :param draw_obj:
    :param box: [x1, y1, x2, y2]
    :return:
use draw lines to draw rectangle. since the draw_rectangle func can not modify the width of rectangle
    :param draw_obj:
    :param box: [x1, y1, x2, y2]
    :return:
use draw lines to draw rectangle . since the draw_rectangle func can not modify the width of rectangle : param draw_obj : : param box : [ x1 y1 x2 y2 ] : return :
def draw_a_rectangel_in_img(draw_obj, box, color, width, method):
    '''
    use draw lines to draw rectangle. since the draw_rectangle func can not modify the width of rectangle
    :param draw_obj:
    :param box: [x1, y1, x2, y2]
    :return:
    '''
    if method == 0:
        x1, y1, x2, y2 = box[0], box[1], box[2], box[3]
        top_left, top_right = (x1, y1), (x2, y1)
        bottom_left, bottom_right = (x1, y2), (x2, y2)

        draw_obj.line(xy=[top_left, top_right],
                      fill=color,
                      width=width)
        draw_obj.line(xy=[top_left, bottom_left],
                      fill=color,
                      width=width)
        draw_obj.line(xy=[bottom_left, bottom_right],
                      fill=color,
                      width=width)
        draw_obj.line(xy=[top_right, bottom_right],
                      fill=color,
                      width=width)
    else:
        x_c, y_c, w, h, theta = box[0], box[1], box[2], box[3], box[4]
        rect = ((x_c, y_c), (w, h), theta)
        rect = cv2.boxPoints(rect)
        rect = np.int0(rect)
        draw_obj.line(xy=[(rect[0][0], rect[0][1]), (rect[1][0], rect[1][1])],
                      fill=color,
                      width=width)
        draw_obj.line(xy=[(rect[1][0], rect[1][1]), (rect[2][0], rect[2][1])],
                      fill=color,
                      width=width)
        draw_obj.line(xy=[(rect[2][0], rect[2][1]), (rect[3][0], rect[3][1])],
                      fill=color,
                      width=width)
        draw_obj.line(xy=[(rect[3][0], rect[3][1]), (rect[0][0], rect[0][1])],
                      fill=color,
                      width=width)
def draw_a_rectangel_in_img ( draw_obj , box , color , width , method ) : if method == 0 : x1 , y1 , x2 , y2 = box [ 0 ] , box [ 1 ] , box [ 2 ] , box [ 3 ] top_left , top_right = ( x1 , y1 ) , ( x2 , y1 ) bottom_left , bottom_right = ( x1 , y2 ) , ( x2 , y2 ) draw_obj . line ( xy = [ top_left , top_right ] , fill = color , width = width ) draw_obj . line ( xy = [ top_left , bottom_left ] , fill = color , width = width ) draw_obj . line ( xy = [ bottom_left , bottom_right ] , fill = color , width = width ) draw_obj . line ( xy = [ top_right , bottom_right ] , fill = color , width = width ) else : x_c , y_c , w , h , theta = box [ 0 ] , box [ 1 ] , box [ 2 ] , box [ 3 ] , box [ 4 ] rect = ( ( x_c , y_c ) , ( w , h ) , theta ) rect = cv2 . boxPoints ( rect ) rect = np . int0 ( rect ) draw_obj . line ( xy = [ ( rect [ 0 ] [ 0 ] , rect [ 0 ] [ 1 ] ) , ( rect [ 1 ] [ 0 ] , rect [ 1 ] [ 1 ] ) ] , fill = color , width = width ) draw_obj . line ( xy = [ ( rect [ 1 ] [ 0 ] , rect [ 1 ] [ 1 ] ) , ( rect [ 2 ] [ 0 ] , rect [ 2 ] [ 1 ] ) ] , fill = color , width = width ) draw_obj . line ( xy = [ ( rect [ 2 ] [ 0 ] , rect [ 2 ] [ 1 ] ) , ( rect [ 3 ] [ 0 ] , rect [ 3 ] [ 1 ] ) ] , fill = color , width = width ) draw_obj . line ( xy = [ ( rect [ 3 ] [ 0 ] , rect [ 3 ] [ 1 ] ) , ( rect [ 0 ] [ 0 ] , rect [ 0 ] [ 1 ] ) ] , fill = color , width = width )