connected(spatstat)
connected()所属R语言包:spatstat
Connected components of an image or window
连接部件的图像或窗口
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Finds the topologically-connected clumps of pixels in an image or window.
查找的图像或窗口中的像素的拓扑连接的团块。
用法----------Usage----------
connected(X, background = NA, method="C")
参数----------Arguments----------
参数:X
Image (object of class "im") or window (object of class "owin").
图片(对象类"im")或窗口(对象类"owin")。
参数:background
Optional. Treat pixels with this value as being part of the background.
可选。将像素使用这个值作为背景的一部分。
参数:method
String indicating the algorithm to be used. Either "C" or "interpreted". See Details.
字符串,用于指示要使用的算法。无论是"C"或"interpreted"。查看详细信息。
Details
详细信息----------Details----------
This function computes the connected component transform (Rosenfeld and Pfalz, 1966) of a binary image or binary mask. The argument X is first converted into a pixel image with logical values. Then the algorithm identifies the connected components (topologically-connected clumps of pixels) in the foreground.
此函数计算所连接的成分变换的二值图像或二进制掩码(罗森菲尔德和普法尔茨州,1966年)。参数X是先转换成一个像素的图像与逻辑值。然后,该算法识别所连接的设备(拓扑连接的团块像素)前景。
Two pixels belong to the same connected component if they have the value TRUE and if they are neighbours (in the 8-connected sense). This rule is applied repeatedly until it terminates. Then each connected component contains all the pixels that can be reached by stepping from neighbour to neighbour.
两个像素属于同一关连的组件,如果他们的价值TRUE,如果他们是邻居(8通感)。此规则应用于反复,直到终止。然后,每个连接的组件包含了所有的像素可以达到加强从邻居到邻居。
If method="C", the computation is performed by a compiled C language implementation of the classical algorithm of Rosenfeld and Pfalz (1966). If method="interpreted", the computation is performed by an R implementation of the algorithm of Park et al (2000).
如果method="C",计算是由一个已编译的C语言实现中的经典算法,罗森菲尔德和普法尔茨州(1966年)。如果method="interpreted",进行由Park等人(2000)的算法的R执行计算。
The result is a factor-valued image, with levels that correspond to the connected components. The Examples show how to extract each connected component as a separate window object.
其结果是一个因子值的图像,对应于所连接的部件的水平。以下示例显示了如何提取每个连接的组件作为一个单独的窗口对象。
值----------Value----------
A pixel image (object of class "im") with factor values. The levels of the factor correspond to the connected components.
像素的图像(类的对象"im")因子值。因子的水平对应于所连接的组件。
警告----------Warnings----------
It may be hard to distinguish different components in the default plot because the colours of nearby components may be very similar. See the Examples for a randomised colour map.
这可能是很难在默认的图,因为附近的成分可能会非常相似的颜色来区分不同的组件。颜色随机图的例子。
The algorithm for method="interpreted" can be very slow for large images (or images where the connected components include a large number of pixels).
该算法为method="interpreted"可以是非常慢,对于大图像(或其中所连接的组件包括一个大的像素数的图像)。
(作者)----------Author(s)----------
Original <font face="Courier New,Courier" color="#666666"><b>R</b></font> code by Julian Burgos, University of Washington.
Adapted for <span class="pkg">spatstat</span> by
Adrian Baddeley
<a href="mailto:Adrian.Baddeley@csiro.au">Adrian.Baddeley@csiro.au</a>
<a href="http://www.maths.uwa.edu.au/~adrian/">http://www.maths.uwa.edu.au/~adrian/</a>
and Rolf Turner
<a href="mailto:r.turner@auckland.ac.nz">r.turner@auckland.ac.nz</a>
参考文献----------References----------
Fast connected component labeling algorithm using a divide and conquer technique. Pages 373-376 in S.Y. Shin (ed) Computers and Their Applications: Proceedings of the ISCA 15th International Conference on Computers and Their Applications, March 29-31, 2000, New Orleans, Louisiana USA. ISCA 2000, ISBN 1-880843-32-3.
Sequential operations in digital processing. Journal of the Association for Computing Machinery 13 471-494.
参见----------See Also----------
im.object, tess
im.object,tess
实例----------Examples----------
data(cells)
d <- distmap(cells, dimyx=256)
X <- levelset(d, 0.06)
plot(X)
Z <- connected(X)
plot(Z)
# number of components[的部件数量]
nc <- length(levels(Z))
# plot with randomised colour map[图与随机彩色图]
plot(Z, col=hsv(h=sample(seq(0,1,length=nc), nc)))
# how to extract the components as a list of windows[如何提取组件窗口列表]
W <- tiles(tess(image=Z))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|