Opencv图像在找到轮廓后被扭曲

Opencv image is contorted after finding contours

在图像中找到轮廓后,图像发生变化。这有什么原因吗?

myContours, myHierarchy = cv2.findContours(inputImage, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

OpenCV 轮廓影响源图像。如果您不想更改源图像,我建议您复制输入图像。类似于:

myContours, myHierarchy = cv2.findContours(inputImage.copy(), # This creates a copy of the original image and any changes will not affect your original image
cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)