I'm trying to read the contours from opencv and transfer it to matplotlib for display. Here is my code.
What should I do?
img = cv2.imread('sample.jpeg')
_, bin_img = cv2.threshold(cv2.cvtColor(img, cv2.COLOR_BGR2GRAY), 180, 255,
cv2.THRESH_BINARY_INV)
contours, hierarchy = cv2.findContours(bin_img, mode, method)
plt.contour(contours)
It throws an error:
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (111,) + inhomogeneous part.