0

I want to save images to a new file on each iteration:

 str1='vid_result'
 str2=str1+str(ret)
 cv2.imwrite(str(str2),im)

Where ret is a counter.

But I receive the error:

Could not find a writer for the specified extension in function cv::imwrite_.

Actually, cv2.imwrite('vid_result',im) works fine, so I need to find a proper way to send a filename as a first argument.

P.S. The str2 is a string and its output is vid_result1.

martineau
  • 119,623
  • 25
  • 170
  • 301

1 Answers1

-1

It sounds ("writer for the specified extension") like it is trying to figure out how to write the image based on the file name and failing. Print out the value of str2 and I think that will make the problem obvious.

Michael Lorton
  • 43,060
  • 26
  • 103
  • 144