日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

scipy.ndimage.zoom上采样与下采样

發布時間:2023/12/13 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 scipy.ndimage.zoom上采样与下采样 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.


插值


Bilinear interpolation would be order=1, nearest is order=0, and cubic is the default (order=3).

舉例說明

import numpy as np import 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張小抄

總結

以上是生活随笔為你收集整理的scipy.ndimage.zoom上采样与下采样的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。