tf.image.adjust_brightness other use

tensorflow TF AS Import 
Import numpy AS NP
Import CV2 AS CV
Import matplotlib.pyplot AS PLT
Sess = tf.Session ()
name = '.. / main / 0.jpg' relative positions #
img = tf.read_file (name) # with tf read image
img = tf.image.decode_image (img) # because reading image for the character to be decoded
img_shape = sess.run (img) # only run the command you can get the picture data
img_shape = img_shape.shape # get the image shape
img_sha = tf.reshape (img, [1 , img_shape [0], img_shape [1], img_shape [2]]) # contrast function tf.image.adjust_brightness bulk because the bulk processing solution tf
new_img = tf.image.adjust_brightness (img_sha, 0.5) # 0.5 to 0.5 times when the contrast enhancement of the contrast reduction -0.5 0.5 times 
new_img = sess.run (new_img)
new_img new_img.reshape = ((img_shape [0], img_shape [ . 1], img_shape [2]))
new_img = np.array (new_img, np.uint8)


cv.imshow ( 'dd', new_img)
cv.waitKey ()

Guess you like

Origin www.cnblogs.com/tangjunjun/p/11817095.html