How would I solve this error: TypeError: image is not a numpy array, neither a scalar?
I am following the OpenCV tutorial about image contours and creating the outline of a shape, however on the final line of the code that has been provided I receive the error:
TypeError: image is not a numpy array, neither a scalar
My code reads:
import numpy as np
import cv2
im = cv2.imread("shapes_and_colors.png")
imgray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)
ret,thresh = cv2.threshold(imgray,127,255,0)
im2, contours, hierarchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
cv2.drawContours("shapes_and_colors.png", contours, -1, (0,255,0), 3)
Any help would be greatly appreciated :)
Thanks!