extract_pheno: Extract phenotypical features from segmented images

Description Usage Arguments Value See Also Examples

View source: R/extract_pheno.R

Description

This function extracts phenotypical features from segmented images.

Usage

1
extract_pheno(processed_image, Xsize = 1, Ysize = 1, a = 1, b = 1)

Arguments

processed_image

a binary matrix contains only 0 and 1, giving the segmented image of a plant.

Xsize, Ysize

Xsize and Ysize are the actual horizontal and vertical lengths of one pixel, respectively. The default set is Xsize = 1, Ysize = 1 for the non-adjustment for the pixel size.

a,b

positive integers, the same as the values of RowSample and ColSample in the function: "downsize", respectively. This is only used if the function "downsize" was used to reduce the size of the image in image segmentation.

Value

pixelCount

The total number of pixels of the segmented plant of interest.

plantheight

The height of the segmented plant.

plantwidth

The width of the segmented plant.

plantSize

The size of the segmented plant based on the total number of pixels of the segmented plant of interest. i.e. Size = pixelCount * Xsize * Ysize.

See Also

downsize for reducing size of an image.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#read an RGB image
library(png)
imageOriginal = readPNG(system.file("extdata", "image1.png",
                             package = "implant",
                             mustWork = TRUE))[ , ,c(1:3)]
#reduce the size of an image
image_reduced = downsize(imageOriginal, RowSample = 2, ColSample = 2)
#segment the reduced image
imageB = imageBinary(image_reduced,  weight = c(-1, 2, -1), threshold1 = 30 / 255, threshold2 = 0.05)
#obtain the size of the segmented image
extract_pheno(processed_image = imageB, Xsize = 1.5, Ysize = 1.5, a = 2, b = 2)$size

rwang14/implant documentation built on Sept. 6, 2020, 3:21 a.m.