When drawing a contour using OpenCV's drawContours
the borders is drawn centered to the contour, I want to draw the border only on the outside of the contour.
This image (taken from the SketchUp documentation) explains it best:
drawContours
draws the contour like in the first circle (the contour is in the middle of the drawn border). I need to have the border only on the outside of the contour, like in the last circle.
Anyone have an idea as to how can I achieve this kind of behaviour?
Thanks.
use the code as
_ret, contours, hierarchy = cv2.findContours(threshold, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
cv2.drawContours(img,contours , -1, (255,0,0), 1)
here cv2.RETR_EXTERNAL gives only the external detected contour.