python-scipy 图像处理
2016-06-25 17:36
337 查看
from PIL import Image
from numpy import *
from scipy.ndimage import filters
img=Image.fromarray(im)
img.show()
img2=Image.fromarray(im2)
img2.show()
filters.sobel(im,1,imx)
imy=zeros(im.shape)
filters.sobel(im,0,imy)
magnitude=sqrt(imx**2+imy**2)
magnitudeimg=Image.fromarray(uint8(magnitude))
magnitudeimg.show()
from numpy import *
from scipy.ndimage import filters
读入图像并转化成灰度图像
im=array(Image.open(‘lena.jpg’).convert(‘L’))高斯滤波
im2=filters.gaussian_filter(im,5)img=Image.fromarray(im)
img.show()
img2=Image.fromarray(im2)
img2.show()
sobel滤波器
imx=zeros(im.shape)filters.sobel(im,1,imx)
imy=zeros(im.shape)
filters.sobel(im,0,imy)
magnitude=sqrt(imx**2+imy**2)
magnitudeimg=Image.fromarray(uint8(magnitude))
magnitudeimg.show()
相关文章推荐
- python 三元条件判断的3种实现方法
- python-PIL 图像基本操作
- Python3之pickle模块
- Python demjson 下载并安装
- python 命令行传入参数
- python之数据运算
- 使用scapy分析pcap报文
- Python3之json模块
- 二项分布和Beta分布
- Python 汉字简体和繁体的相互转换
- python之SocketServer编程
- python 使用zip反转字典
- Python-穷举搜索Google方程式
- Python读取大文件的最后N行
- Python sftp到远程服务器读取日志文件
- python-numpy、scipy
- python使用pytesseract识别验证码的方法
- python 安装easy_install和pip
- Python学习-baseNo.1
- python根据文件目录、文件类型和文件与当前时间差删除文件