scipy.ndimage.zoom上采样与下采样
来源:互联网 发布:淘宝双人床垫 编辑:程序博客网 时间:2024/06/10 04:09
插值
Bilinear interpolation would be order=1, nearest is order=0, and cubic is the default (order=3).
举例说明
import numpy as npimport scipy.ndimagex = np.arange(64).reshape(8,8)print 'Original array:'print xprint 'Resampled by a factor of 2 with nearest interpolation:'print scipy.ndimage.zoom(x, 2, order=0)print 'Resampled by a factor of 2 with bilinear interpolation:'print scipy.ndimage.zoom(x, 2, order=1)print 'Resampled by a factor of 2 with cubic interpolation:'print scipy.ndimage.zoom(x, 2, order=3)print 'Downsampled by a factor of 0.5 with default interpolation:'print(scipy.ndimage.zoom(x, 0.5))
结果
Original array:array([[ 0, 1, 2, 3, 4, 5, 6, 7], [ 8, 9, 10, 11, 12, 13, 14, 15], [16, 17, 18, 19, 20, 21, 22, 23], [24, 25, 26, 27, 28, 29, 30, 31], [32, 33, 34, 35, 36, 37, 38, 39], [40, 41, 42, 43, 44, 45, 46, 47], [48, 49, 50, 51, 52, 53, 54, 55], [56, 57, 58, 59, 60, 61, 62, 63]])Resampled by a factor of 2 with nearest interpolation:[[ 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7] [ 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7] [ 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15] [ 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15] [16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23] [16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23] [24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31] [24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31] [32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39] [32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39] [40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47] [40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47] [48 48 49 49 50 50 51 51 52 52 53 53 54 54 55 55] [48 48 49 49 50 50 51 51 52 52 53 53 54 54 55 55] [56 56 57 57 58 58 59 59 60 60 61 61 62 62 63 63] [56 56 57 57 58 58 59 59 60 60 61 61 62 62 63 63]]Resampled by a factor of 2 with bilinear interpolation:[[ 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7] [ 4 4 5 5 6 6 7 7 7 8 8 9 9 10 10 11] [ 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 14] [11 12 12 13 13 14 14 14 15 15 16 16 17 17 18 18] [15 15 16 16 17 17 18 18 19 19 20 20 21 21 21 22] [19 19 20 20 21 21 21 22 22 23 23 24 24 25 25 26] [22 23 23 24 24 25 25 26 26 27 27 28 28 28 29 29] [26 27 27 28 28 28 29 29 30 30 31 31 32 32 33 33] [30 30 31 31 32 32 33 33 34 34 35 35 35 36 36 37] [34 34 35 35 35 36 36 37 37 38 38 39 39 40 40 41] [37 38 38 39 39 40 40 41 41 42 42 42 43 43 44 44] [41 42 42 42 43 43 44 44 45 45 46 46 47 47 48 48] [45 45 46 46 47 47 48 48 49 49 49 50 50 51 51 52] [49 49 49 50 50 51 51 52 52 53 53 54 54 55 55 56] [52 53 53 54 54 55 55 56 56 56 57 57 58 58 59 59] [56 56 57 57 58 58 59 59 60 60 61 61 62 62 63 63]]Resampled by a factor of 2 with cubic interpolation:[[ 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7] [ 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 9] [ 7 8 8 9 9 10 10 11 11 12 12 12 13 13 14 14] [12 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19] [15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22] [19 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26] [22 23 23 24 24 25 25 26 26 27 27 27 28 28 29 29] [26 26 27 28 28 28 29 29 30 30 31 31 32 32 33 33] [30 30 31 31 32 32 33 33 34 34 35 35 35 36 37 37] [34 34 35 35 36 36 36 37 37 38 38 39 39 40 40 41] [37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 44] [41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48] [44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 51] [49 49 50 50 51 51 51 52 52 53 53 54 54 55 55 56] [54 54 54 55 55 56 56 57 57 58 58 59 59 60 60 61] [56 56 57 57 58 58 59 59 60 60 61 61 62 62 63 63]]Downsampled by a factor of 0.5 with default interpolation:[[ 0 2 5 7] [19 21 23 26] [37 40 42 44] [56 58 61 63]]
参考文献
Resampling a numpy array representing an image
机器学习入门必备的13张小抄
阅读全文
0 0
- scipy.ndimage.zoom上采样与下采样
- 上采样 下采样
- 上采样和下采样
- 扫盲 - 下采样与上采样
- 降采样,过采样,欠采样,子采样,下采样,上采样【转自EDNChina】
- 降采样,过采样,欠采样,子采样,下采样,上采样【转自EDNChina】
- 降采样,过采样,欠采样,子采样,下采样,上采样
- opencv-图像金字塔-上采样-下采样
- opencv-图像金字塔-上采样-下采样
- 降采样,过采样,欠采样,子采样,下采样,上采样,你学会了吗?【总结】
- 降采样,过采样,欠采样,子采样,下采样,上采样,你学会了吗?【总结】
- 图像的上采样(upsampling)与下采样(subsampled)
- 图像的上采样(upsampling)与下采样(subsampled)
- 图像的上采样(upsampling)与下采样(subsampled)
- 图像的上采样(upsampling)与下采样(subsampled)
- 图像的上采样(upsampling)与下采样(subsampled)
- 图像的上采样(upsampling)与下采样(subsampled)
- 图像的上采样(upsampling)与下采样(subsampled)
- linux 下mysql5.7安装步骤(更新:最新版本mysql5.7.20.deb安装)
- 队列queue的使用方法
- springmvc中几个标签
- spring 实现自定义 ioc(简单版)
- spring 模拟之 aop
- scipy.ndimage.zoom上采样与下采样
- 刷清橙OJ--A1021.集合运算
- [IO系统]18 IO调度器
- 机器学习知识点(二十七)先验概率和后验概率理解
- 深入学习Oracle分区表及分区索引
- 《Real-Time Rendering 3rd》 提炼总结】(一) 全书知识点总览
- MySQL数据插入、更新、删除
- el表达式在jsp中获取.properties配置文件中的配置常量
- 基于固件库建立一个STM32的工程模板