Dataset.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:CNN-people-detect 作者: JTKBowers 项目源码 文件源码
def render_bboxes_image(bboxes, output_width, output_height, input_width, input_height):
    '''
    Render the bounding boxes (bboxes) on an image of size (output_width, output_height),
    where the bounding box coordinates exist between (0,0) and (input_width, input_height).
    '''
    output_image = np.zeros((output_height, output_width), dtype=np.uint8)

    w_scale = output_width/input_width
    h_scale = output_height/input_height
    for min_x, min_y, max_x, max_y in bboxes:
        pt1 = (int(min_x*w_scale), int(min_y*h_scale))
        pt2 = (int(max_x*w_scale), int(max_y*h_scale))
        cv2.rectangle(output_image,pt1, pt2, 255, cv2.FILLED)
    return output_image
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号