Thickness param in cv2.drawContours

You could try to draw it and see what you get.

import cv2
import numpy as np

img = np.zeros((10, 10, 3))

points = np.asarray([[(2,2),(7,2),(7,7),(2,7)]])

img = cv2.drawContours(img, points, 0, (0,255,0), 2) # green
img = cv2.drawContours(img, points, 0, (0,0,255), 1) # red

cv2.imshow('image', img)
cv2.waitKey(0)

cv2.destroyAllWindows()

For single pixel thickness it should be inside object (see red line on image)
but for bigger thickness it should be partially inside and partially outside (see green line on image)

Zrzut ekranu z 2021-06-04 21-40-45

1 Like