关于python使用cv画矩形并填充颜色同时填充文字

 font = cv2.FONT_HERSHEY_SIMPLEX  # 使用默认字体
 cv2.rectangle(im, (10, 10), (110, 110), (0, 0, 255), thickness=2)
                    # cv2.floodFill()
                    cv2.rectangle(im, (113), int(110)), (int(300), int(135),
                                  (255, 0, 0), thickness=-1)
                    cv2.putText(im, class_name + ' ' + str(score), (int(113, int(126)), font, 0.6,
                                (255, 255, 255), 1)

效果图:

posted @ 2017-05-08 12:18  龚细军  阅读(18620)  评论(2编辑  收藏  举报