calc_features: Calculate filter features

Description Usage Arguments Value Functions Examples

View source: R/calculate_features.R

Description

Calculates features for each pixel based on sobel filters, gaussian and difference of gaussians, adds as well the position in the image

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
calc_features(
  img,
  filter_widths = c(3, 5, 11, 23),
  shape_sizes = c(51, 101, 151, 201, 251),
  verbose = FALSE
)

compile_calc_features(
  filter_widths = c(3, 5, 11, 23),
  shape_sizes = c(51, 101, 151, 201, 251),
  img_dim,
  verbose = FALSE
)

Arguments

img

an imput image or matrix

filter_widths

a numeric vector of odd numbers to be used as the width of the feature filters

shape_sizes

a numeric vector of odd numbers indicating the expected size of the shapes to be found

verbose

wether to display progress messages

Value

data.frame

Functions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
test_image <- matrix(runif(10201), 101)
feature_df <- calc_features(
    test_image, filter_widths = c(3,5),
    shape_sizes = c(11, 21))
head(feature_df)

feature_funs <- compile_calc_features(
     filter_widths = c(3,5), shape_sizes = c(11, 21),
     dim(test_image))
feature_funs[[1]](test_image)

feature_df2 <- purrr::map_dfc(feature_funs, ~ as.numeric(.x(test_image)))
head(feature_df2)

jspaezp/clasifierrr documentation built on March 2, 2020, 11:20 a.m.