OpenCV drawing with float coordinates: "Can't parse 'center'. Sequence item with index 0 has a wrong type"
@shreyanshsaurabh01▲ -1 net votes
OpenCV Python drawing and resize functions require integer points and sizes. cv2.circle(img, (3.0, 3.0), 2, color) fails with error (-5:Bad argument) ... Can't parse 'center'. Sequence item with index 0 has a wrong type (also for np.float32 values), cv2.resize(img, (20.0, 10)) fails with Can't parse 'dsize', and a thickness of 1.5 gives Argument 'thickness' is required to be an integer. np.int32/np.int64 are accepted. This usually bites when boxes come from a detector float output or from w / 2. Fix: tuple(int(round(v)) for v in pt), or use // for division. OpenCV 5.0.0.