用法:
skimage.util.regular_grid(ar_shape, n_points)
找到沿ar_shape 規律分布的 n_points。
返回的點(作為切片)應盡可能接近立方間距。本質上,這些點的間距是輸入數組大小的第 N 個根,其中 N 是維數。但是,如果一個數組維度不能滿足一個完整的步長,它是“discarded”,並且隻對剩餘的維度進行計算。
- ar_shape:array-like 個整數
嵌入網格的空間的形狀。
len(ar_shape)
是維數。- n_points:int
要嵌入空間的(近似)點數。
- slices:切片對象的元組
沿ar_shape 的每個維度的切片,使得所有切片的交點給出規則間隔點的坐標。
參數:
返回:
例子:
>>> ar = np.zeros((20, 40)) >>> g = regular_grid(ar.shape, 8) >>> g (slice(5, None, 10), slice(5, None, 10)) >>> ar[g] = 1 >>> ar.sum() 8.0 >>> ar = np.zeros((20, 40)) >>> g = regular_grid(ar.shape, 32) >>> g (slice(2, None, 5), slice(2, None, 5)) >>> ar[g] = 1 >>> ar.sum() 32.0 >>> ar = np.zeros((3, 20, 40)) >>> g = regular_grid(ar.shape, 8) >>> g (slice(1, None, 3), slice(5, None, 10), slice(5, None, 10)) >>> ar[g] = 1 >>> ar.sum() 8.0
相關用法
- Python skimage.util.regular_seeds用法及代碼示例
- Python skimage.util.view_as_windows用法及代碼示例
- Python skimage.util.montage用法及代碼示例
- Python skimage.util.label_points用法及代碼示例
- Python skimage.util.view_as_blocks用法及代碼示例
- Python skimage.util.unique_rows用法及代碼示例
- Python skimage.util.invert用法及代碼示例
- Python skimage.feature.graycomatrix用法及代碼示例
- Python skimage.color.lab2lch用法及代碼示例
- Python skimage.draw.random_shapes用法及代碼示例
- Python skimage.feature.blob_doh用法及代碼示例
- Python skimage.feature.blob_dog用法及代碼示例
- Python skimage.filters.unsharp_mask用法及代碼示例
- Python skimage.registration.optical_flow_tvl1用法及代碼示例
- Python skimage.filters.rank.noise_filter用法及代碼示例
- Python skimage.exposure.histogram用法及代碼示例
- Python skimage.filters.gaussian用法及代碼示例
- Python skimage.feature.graycoprops用法及代碼示例
- Python skimage.segmentation.active_contour用法及代碼示例
- Python skimage.feature.corner_orientations用法及代碼示例
注:本文由純淨天空篩選整理自scikit-image.org大神的英文原創作品 skimage.util.regular_grid。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。