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都可以这样用,但是我的就不可以,请问有无解决办法?