calc_texture: Calculates a glcm texture for use in the glcm.R script

Description Usage Arguments Value Examples

View source: R/RcppExports.R

Description

This function is called by the glcm function. It is not intended to be used directly.

Usage

1
calc_texture(d, n_grey, window_dims, shift, statistics, na_opt, na_val)

Arguments

d

a matrix containing the pixels to be used in the texture calculation

n_grey

number of grey levels to use in texture calculation

window_dims

2 element list with row and column dimensions of the texture window

shift

a matrix where each row gives an (x, y) shift to use when computing co-occurrency matrices. Textures will be calculated for each shift, and the average over all shifts will be returned.

statistics

a list of strings naming the texture statistics to calculate

na_opt

one of "ignore", "center", or "any"

na_val

what value to use to fill missing values on edges or where necessary due to chosen na_opt value

Value

a list of length equal to the length of the statistics input parameter, containing the selected textures measures

Examples

1
2
3
4
5
# Calculate GLCM textures on a matrix using low-level calc_texture function
d <- matrix(seq(1:25), nrow=5, ncol=5, byrow=TRUE)
calc_texture(d, n_grey=25, window_dims=c(3,3),
             shift=matrix(c(1,1), nrow=1), statistics=c('variance'),
             na_opt="any", na_val=NA)

Example output

, , 1

     [,1]      [,2]      [,3] [,4] [,5]
[1,]   NA        NA        NA   NA   NA
[2,]   NA  60.89333  74.48693   NA   NA
[3,]   NA 147.29333 170.10293   NA   NA
[4,]   NA        NA        NA   NA   NA
[5,]   NA        NA        NA   NA   NA

glcm documentation built on March 26, 2020, 7:47 p.m.