【问题标题】:Saving decoded images from an autoencoder从自动编码器保存解码图像
【发布时间】:2019-01-24 15:42:27
【问题描述】:

因此,可以看到,here 的自动编码器 Keras 代码的这一部分尝试重建编码图像:

decoded_images = decoder.predict(encoded_images)

我正在尝试保存解码后的图像,如下:

for i in range(len(decoded_images)):
    cv2.imwrite(results_directory + '/' + str(i),decoded_images[i])

但是我得到以下错误:

cv2.error: /dev/shm/ebuser/OpenCV/2.4.13.3/gmkl-2016.4/opencv-2.4.13.3/modules/highgui/src/loadsave.cpp:275: error: (-2) could not find a writer for the specified extension in function imwrite

这是为什么呢?我该如何解决这个错误?

【问题讨论】:

    标签: python opencv keras autoencoder


    【解决方案1】:

    我注意到我只需要添加一个扩展名,例如.jpg,如下:

    cv2.imwrite(results_directory + '/' + str(i) + '.jpg',decoded_images[i])

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-31
      • 1970-01-01
      • 2018-03-22
      • 2015-04-23
      • 2018-04-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多