OpenCV TypeError: bad argument type for built-in operation

I'm using OpenCV v4.0.1 and want to save an image into a file, but I get the following error:

cv2.imwrite(new_image, dest + '/images/' + file_name + '.png')
Traceback (most recent call last):
  File "script.py", line 45, in <module>
    cv2.imwrite(new_image, dest + '/images/' + file_name + '.png')
TypeError: bad argument type for built-in operation
imageopencv
3 votesLP185.00
1 Answers
JO218.00
3

Because you don't use cv2.imwrite properly. cv2.imwrite takes 1st argument as filename, then 2nd argument as an image.

cv2.imwrite(file_path, img)
Reply
Couldn't find what you were looking for?and we will find an expert to answer.
How helpful was this page?