import cv2
import numpy as np img = np.mat(np.zeros((,)))
cv2.imshow("test",img)
cv2.waitKey()
import cv2
import numpy as np img = np.mat(np.zeros((,),dtype=np.uint8))
cv2.imshow("test",img)
cv2.waitKey()
import cv2
import numpy as np image = np.mat(np.zeros((,)))
imageByteArray = bytearray(image)
print(imageByteArray)
imageBGR = np.array(imageByteArray).reshape(,)
cv2.imshow("cool",imageBGR)
cv2.waitKey()
import os
import cv2
import numpy as np randomByteArray = bytearray(os.urandom())
flatNumpyArray = np.array(randomByteArray).reshape(,)
cv2.imshow("cool",flatNumpyArray)
cv2.waitKey()
import cv2
import numpy as np
img = np.zeros((,))
img[,] =
cv2.imshow("img",img)
cv2.waitKey()
import cv2
import numpy as np img = np.zeros((300,300))
img[:,10] = 255
img[10,:] = 255
cv2.imshow("img",img)
cv2.waitKey(0)
import cv2
import numpy as np from scipy import ndimage kernel33 = np.array([[-1,-1,-1],
[-1,8,-1],
[-1,-1,-1]]) kernel33_D = np.array([[1,1,1],
[1,-8,1],
[1,1,1]]) img = cv2.imread("G:\\MyLearning\\TensorFlow_deep_learn\\data\\lena.jpg",0)
linghtImg = ndimage.convolve(img,kernel33_D)
cv2.imshow("img",linghtImg)
cv2.waitKey()

import numpy as np
import cv2
from scipy import ndimage img = cv2.imread("lena.jpg",0)
blurred = cv2.GaussianBlur(img,(11,11),0)
gaussImg = img - blurred
cv2.imshow("img",gaussImg)
cv2.waitKey()

import numpy as np

def convolve(dateMat,kernel):
m,n = dateMat.shape
km,kn = kernel.shape
newMat = np.ones(((m - km + 1),(n - kn + 1)))
tempMat = np.ones(((km),(kn)))
for row in range(m - km + 1):
for col in range(n - kn + 1):
for m_k in range(km):
for n_k in range(kn):
tempMat[m_k,n_k] = dateMat[(row + m_k),(col + n_k)] * kernel[m_k,n_k]
newMat[row,col] = np.sum(tempMat)
return newMat dateMat = np.mat([
[1,2,1,2,0,1,0,1,1],
[0,3,1,1,0,0,1,0,1],
[1,2,1,0,2,1,1,0,0],
[2,2,0,1,1,1,1,1,0],
[3,1,1,0,1,1,0,0,1],
[1,0,1,1,1,0,0,1,1],
[1,1,1,1,0,1,1,1,1],
[1,0,1,1,0,1,0,1,0],
[0,1,1,1,1,2,0,1,0]
]) kernel = np.mat([
[1,0,1],
[0,-4,0],
[1,0,1]
]) newMat = convolve(dateMat,kernel)
print(np.shape(newMat))
print(newMat)

吴裕雄 python深度学习与实践(7)的更多相关文章

  1. 吴裕雄 python深度学习与实践(18)

    # coding: utf-8 import time import numpy as np import tensorflow as tf import _pickle as pickle impo ...

  2. 吴裕雄 python深度学习与实践(17)

    import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data import time # 声明输 ...

  3. 吴裕雄 python深度学习与实践(16)

    import struct import numpy as np import matplotlib.pyplot as plt dateMat = np.ones((7,7)) kernel = n ...

  4. 吴裕雄 python深度学习与实践(15)

    import tensorflow as tf import tensorflow.examples.tutorials.mnist.input_data as input_data mnist = ...

  5. 吴裕雄 python深度学习与实践(14)

    import numpy as np import tensorflow as tf import matplotlib.pyplot as plt threshold = 1.0e-2 x1_dat ...

  6. 吴裕雄 python深度学习与实践(13)

    import numpy as np import matplotlib.pyplot as plt x_data = np.random.randn(10) print(x_data) y_data ...

  7. 吴裕雄 python深度学习与实践(12)

    import tensorflow as tf q = tf.FIFOQueue(,"float32") counter = tf.Variable(0.0) add_op = t ...

  8. 吴裕雄 python深度学习与实践(11)

    import numpy as np from matplotlib import pyplot as plt A = np.array([[5],[4]]) C = np.array([[4],[6 ...

  9. 吴裕雄 python深度学习与实践(10)

    import tensorflow as tf input1 = tf.constant(1) print(input1) input2 = tf.Variable(2,tf.int32) print ...

  10. 吴裕雄 python深度学习与实践(9)

    import numpy as np import tensorflow as tf inputX = np.random.rand(100) inputY = np.multiply(3,input ...

随机推荐

  1. python 转义字符 html 爬虫

    用python的requests包 抓取某些网页时,返回的html中,一些字段含有一些 转义字符 \\\\\\\ 这些转义字符给我们后期处理带来一些麻烦, 比方说 运行js等 python用print ...

  2. 学习笔记TF017:自然语言处理、RNN、LSTM

    自然语言处理 (NLP)问题都是序列化的.前馈神经网络,在单次前馈中对到来数据处理,假定所有输入独立,模式丢失.循环神经网络(recurrent neural network,RNN)对时间显式建模神 ...

  3. day 13

    递归函数   一.初始递归 递归函数:在一个函数里在调用这个函数本身. 递归的最大深度:998 正如你们刚刚看到的,递归函数如果不受到外力的阻止会一直执行下去.但是我们之前已经说过关于函数调用的问题, ...

  4. Zookeeper 集群搭建--单机伪分布式集群

    一. zk集群,主从节点,心跳机制(选举模式) 二.Zookeeper集群搭建注意点 1.配置数据文件 myid 1/2/3 对应 server.1/2/3 2.通过./zkCli.sh -serve ...

  5. USB HID设备报告描述符详解(转)

    转自:http://group.ednchina.com/93/198.aspx. 参考:USB HID usage table 概述:   报告在这里意思是数据传输(data transfer),而 ...

  6. 协议并发测试工具 BoHexTest

    BoHexTest V1.0.3 1.添加连接LOG打印2.优化代理及并发策略 大小: 1074688 字节修改时间: 2017年10月3日, 10:24:26MD5: EBAE5A17F7F5ED0 ...

  7. 围绕Buganizer的产品流程

    做技术的一定知道缺陷跟踪系统(bug系统),更不用说做测试的了,不过普遍都认为这系统是用来记录bug的,其实在google内部,这套系统是产品/项目围绕的核心.Google Buganizer扩展了类 ...

  8. ActiveMQ-5.15.2下载和启动(windows)

    一.下载和部署 我的ActiveMQ版本是 5.15.2,参照别人家的博客,下载和启动照样成功.别人家的博客地址: http://blog.csdn.net/clj198606061111/artic ...

  9. 报错:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1

    错误现象: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-com ...

  10. 从OsChina Git下载项目到MyEclipse中

    前提是,拥有权限下载 1.进入MyEclipse,点击File-->Import,选择Git,点击“Next”,如下图: , 2.选择“URI”,点击"Next" 3.输入项 ...