First time here? Check out the FAQ!
You did not declare the input image (img). cv2.imread("input.png")//-->must this line be img = cv2.imread("input.png