Cv2.error: OpenCV(3.4.17) 👎 error: (-5:Bad argument) in function 'imwrite'

here s the error

Exception: Image F:\cw\bbPOV-P-main\API\NewConvert\data/Corebb.jpg could not be found for draw_image. Check the path to the image you provided.
Exception: Image F:\cw\bbPOV-P-main\API\NewConvert\data/logo.jpg could not be found for draw_image. Check the path to the image you provided.
F:\cw\bbPOV-P-main\API\apple.gif
H:\bbPOV-P\123
Traceback (most recent call last):
File “F:\cw\bbPOV-P-main\API\NewConvert\NewConvert.py”, line 72, in start_convert
polarConv(frame,save_path+‘\’+str(frameNum))
File “F:\cw\bbPOV-P-main\API\NewConvert\NewConvert.py”, line 57, in polarConv
cv2.imwrite(outputName+‘.jpg’,polar_image,[int(cv2.IMWRITE_JPEG_QUALITY), 100]+[int(cv2.IMWRITE_JPEG_OPTIMIZE), True])
cv2.error: OpenCV(3.4.17) :-1: error: (-5:Bad argument) in function ‘imwrite’

Overload resolution failed:

  • Can’t parse ‘params’. Sequence item with index 3 has a wrong type
  • Can’t parse ‘params’. Sequence item with index 3 has a wrong type

This is the wrong statement

cv2.imwrite(outputName+‘.jpg’,polar_image,[int(cv2.IMWRITE_JPEG_QUALITY), 100]+[int(cv2.IMWRITE_JPEG_OPTIMIZE), True])

i try to fix it in this way

params = [cv2.IMWRITE_JPEG_QUALITY, 100, cv2.IMWRITE_JPEG_OPTIMIZE, 1]
cv2.imwrite(outputName+‘.jpg’,polar_image, params)

here the new error

Traceback (most recent call last):
File “G:\fansPOV\bbPOV-P-main\NewConvert.py”, line 73, in start_convert
polarConv(frame,save_path+‘\’+str(frameNum))
File “G:\fansPOV\bbPOV-P-main\NewConvert.py”, line 58, in polarConv
cv2.imwrite(outputName+‘.jpg’,polar_image,params)
UnboundLocalError: local variable ‘params’ referenced before assignment

Can anyone help me, thanks

it doesn’t like the True because that’s a bool and it expects a list of int.

give it 1 instead.

thanks bro i got it :grinning: :grinning: