关于cv2.rectangle的问题

def draw_box(image, boxes, classes, scores, category_index, thresh=0.5, line_thickness=5):  # thresh为置信度
    box_to_display_str_map = collections.defaultdict(list)
    box_to_color_map = collections.defaultdict(str)

    filter_low_thresh(boxes, scores, classes, category_index, thresh, box_to_display_str_map, box_to_color_map)
    for box, color in box_to_color_map.items():
        xmin, ymin, xmax, ymax = box
        (left, right, top, bottom) = (xmin * 1, xmax * 1,
                                      ymin * 1, ymax * 1)
        image = cv2.rectangle(image, (left, top), (right, bottom), color, 2)
        image = cv2.putText(image, box_to_display_str_map, (left, top), cv2.FONT_HERSHEY_COMPLEX, 6, color, line_thickness)
Traceback (most recent call last):
  File "C:/Users/xuyp4876/Desktop/Faster-RCNN/摄像头2.py", line 79, in <module>
    main()
  File "C:/Users/xuyp4876/Desktop/Faster-RCNN/摄像头2.py", line 65, in main
    frame = draw_box(frame,
  File "C:\Users\xuyp4876\Desktop\Faster-RCNN\videodraw_box.py", line 60, in draw_box
    image = cv2.rectangle(image, (left, top), (right, bottom), color, 2)
TypeError: function takes exactly 4 arguments (2 given)
[ WARN:0] global C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-71670poj\opencv\modules\videoio\src\cap_msmf.cpp (435) `anonymous-namespace'::SourceReaderCB::~SourceReaderCB terminating async callback
libpng warning: iCCP: cHRM chunk does not match sRGB

我看网上的rectangle都可以这样用,但是我的就不可以,请问有无解决办法?

错误:libpng警告:iCCP:cHRM块与sRGB不匹配

解决:若电脑使用的是QQ输入法,请替换成别的输入法。

您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632