tf.image.decode_jpeg returns wrong image

Viewed 179
import tensorflow as tf
import matplotlib.pyplot as plt
import cv2 
import numpy as np
sess = tf.Session()


jpg1 = cv2.imread("test2.jpg") 

jpg2 = tf.read_file("test2.jpg")
jpg2 = tf.image.decode_jpeg(jpg2) 
jpg2 = sess.run(jpg2) 


cv2.imshow('jpg1', jpg1)
cv2.waitKey(0)
cv2.destroyAllWindows()

cv2.imshow('jpg2', jpg2)
cv2.waitKey(0)
cv2.destroyAllWindows()

original tensorflow's reconstruction

Total difference between pixels on original vs. reconstructed: 12563624

I am trying to load images into tensorflow, but the pixel differences are obviously too large and the color on the reconstructed image isn't true to the original image.

0 Answers
Related