使用SciPy进行常用的图像操作
来源:互联网 发布:无锡房价 知乎 编辑:程序博客网 时间:2024/05/29 11:42
SciPy provides some basic functions to work with images. For example, it has functions to read images from disk into numpy arrays, to write numpy arrays to disk as images, and to resize images. Here is a simple example that showcases these functions:
# coding:utf-8import numpy as npfrom scipy.misc import imread, imsave, imresize# Read an JPEG image into a numpy arrayimg = imread('cat.jpg')print(img.dtype, img.shape) # Prints "uint8 (400, 248, 3)"print(type(np.array(img))) # Prints "<class 'numpy.ndarray'>"# We can tint the image by scaling each of the color channels# by a different scalar constant. The image has shape (400, 248, 3);# we multiply it by the array [1, 0.95, 0.9] of shape (3,);# numpy broadcasting means that this leaves the red channel unchanged,# and multiplies the green and blue channels by 0.95 and 0.9# respectively.img_tinted = img * [1, 0.95, 0.9]# Resize the tinted image to be 300 by 300 pixels.img_tinted = imresize(img_tinted, (300, 300))# Write the tinted image back to diskimsave('cat_tinted.jpg', img_tinted)
阅读全文
0 0
- 使用SciPy进行常用的图像操作
- Scipy的几个简单图像操作
- scipy-图像操作
- Python使用scipy和numpy操作处理图像
- scipy的图像测试
- scipy对图像进行模糊处理
- 使用scipy进行聚类
- scipy的基本操作
- 使用Numpy和Scipy处理图像
- 使用Numpy和Scipy处理图像
- 使用Numpy和Scipy处理图像
- 使用Numpy和Scipy处理图像
- 使用Numpy和Scipy处理图像
- 使用NumPy和SciPy进行数值分析
- 对图像进行卷积操作的意义!
- scipy的二维图像卷积运算
- python SciPy模块的使用
- Python使用matplotlib,numpy,scipy进行散点的平滑曲线化方法
- 设计模式之装饰者设计模式
- python模拟网站登录
- jieba分词
- ERROR 1142 (42000): INSERT command denied to user 'radius'@'localhost' for table 'radcheck'
- 深拷贝和浅拷贝
- 使用SciPy进行常用的图像操作
- html中的特殊字符
- 浅谈Java中的深拷贝和浅拷贝
- Nginx安装配置
- 解决libcudart.so.8.0或libcusolver.so.8.0: cannot open shared object file: No such file or directory
- Android 浏览器内核浅谈
- SharedPreferences工具类
- HDU 6154 CaoHaha's staff 找规律
- HYSYS动态模拟技术培训.pdf