本文介绍了用于返回像素邻域的Ndimage或skimage函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道计算像素邻域的有效方法,并根据输入图像和像素坐标以数组形式返回?我想基于这些邻域计算一些像素级功能,例如集成强度和Haralick功能。

Does anyone know of any efficient ways of computing a pixel's neighborhood and returning it in array form based on an input image and pixel coordinates? I would like to compute a number of pixel level features, such as integrated intensity and the Haralick features, based on these neighborhoods.

推荐答案

我至少可以想到两种方法:

I can think of at least two approaches:


  1. 构造切片与坐标对应的对象,然后分别使用这些切片索引到数组中。

  2. 构造索引基于坐标的数组,并使用花式索引来提取窗口。这需要更多内存,但如果你想一次性抓住所有窗口,速度会更快。有关类似的示例,请查看此示例:

  1. Construct slice objects corresponding to your coordinates, then index into the array with those slices individually.
  2. Construct index arrays based on your coordinates, and use fancy indexing to extract the windows. This requires more memory, but is faster if you want to grab all windows with one go. For an example of something similar, have a look at this example: http://stefanvdwalt.bitbucket.org/assp2013/numpy/#25

这篇关于用于返回像素邻域的Ndimage或skimage函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 20:19