Description Usage Arguments Details Value Examples
A function labels the connected components in a binary image. For example, it can be used for statistical analysis of tracheids (see examples).
1 |
x |
A binary image (A matrix with 0 and 1) |
connect |
8-connectivity or 4-connectivity. Default is 8-connectivity. |
inv |
inverse the binary image x before labelling. Labelling the connected area with 0 when this is TRUE. |
img.show |
If this is TRUE, the image with labelling numbers are shown. |
text.size |
the size of labelling numbers used when img.show=TRUE. |
Labelling the connected components with pixels equal to 1 (white) in a binary image (If pixels equal to 0 (black) should be labelled, select inv=TRUE). The function returns the labelled image and the statistical data of the labelled components.
a list with 2 components (a matrix and a dataframe)
image |
A matrix with labels |
summary |
A dataframe summarizing the labelled components with 8 following variables. |
summary$label |
labelling numbers, area: area of each component |
summary$aveX, summary$aveY |
center position of each component |
summary$dX, summary$dY |
width and height of each component |
summary$edge |
If the component is on the edge of the image, this value is 1, otherwise 0. |
1 2 3 4 5 6 7 8 9 10 11 12 | ## Not run:
data(cryptomeria)
img <- rgb2gray(cryptomeria)
img.c <- crop(img,300,300)
img.bin <- gray2bin(img.c, auto=FALSE, th=180)
par(mfrow=c(2,2))
test <- cc.label(img.bin, connect=8, img.show=TRUE)
hist(test$summary$area,main="histogram of area")
hist(test$summary$dX,main="histogram of dX")
hist(test$summary$dY,main="histogram of dY")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.