TensorFlow--01

# import tensorflow as tf
#
# hello=tf.constant("hello tensorflow!!")
# session=tf.Session()
#
# print(session.run(hello))

import cv2
print('hello opencv')

 


import cv2
#1  文件读取  2 封装解析格式  3数据解码   4 数据加载
img=cv2.imread('1.png',1)#read image    0 读取灰度图片    1读取彩色图片
# cv2.imshow('image',img)
# cv2.waitKey(0)

#图片的写入
cv2.imwrite('image1.jpg',img)

 


import cv2
#1  文件读取  2 封装解析格式  3数据解码   4 数据加载
img=cv2.imread('1.png',1)#read image    0 读取灰度图片    1读取彩色图片
# cv2.imshow('image',img)
# cv2.waitKey(0)

#图片的写入
# cv2.imwrite('image1.jpg',img)

#jpg 设置图片质量0---100  有损压缩
# cv2.imwrite('image3.jpg',img,[cv2.IMWRITE_JPEG_QUALITY,50])

#png  wu损压缩  0---9
# cv2.imwrite('image3.jpg',img,[cv2.IMWRITE_JPEG_QUALITY,50])
# cv2.imwrite('image4.png',img,[cv2.IMWRITE_PNG_COMPRESSION,0])
cv2.imwrite('image5.png',img,[cv2.IMWRITE_PNG_COMPRESSION,9])

 


import cv2

img=cv2.imread('1.png',1)
cv2.imwrite('image6.jpg',1)
(b,g,r)=img[100,100]
print(b,g,r)
#10 100     110  100
for i in range(1,100):
    img[10+i,100]=(0,0,255)
cv2.imshow('imgShow',img)
cv2.waitKey(0)# 1000ms

 


import tensorflow as tf
data1=tf.constant(2,dtype=tf.int32)
data2=tf.Variable(10,name='var')
print(data1)
print(data2)

sess=tf.Session()
print(sess.run(data1))
init=tf.global_variables_initializer()#完成变量的初始化
sess.run(init)

print(sess.run(data2))

 

posted @ 2019-01-08 22:56  巨兽~墨菲特  阅读(244)  评论(0编辑  收藏  举报