clean_colors: A function to remove token colors from standardized photos

View source: R/clean_colors.R

clean_colorsR Documentation

A function to remove token colors from standardized photos

Description

This function allows you to make automatic data entry more accurate by filtering out token color from the photo roster. Simply set a path to the main folder. Then supply an ID code and the token color vectors and shift angles. It is recomended to use cool token colors (e.g., green, blue, and purple), and shift all token colors in the standized photos towards warmer yellow, red, and orange hues.

Usage

clean_colors(
  path = path,
  id = "blank",
  id_full = NA,
  id_short = NA,
  mix_histogram = 0.8,
  high_intensity_thresh = 0.8,
  low_intensity_thresh = 0.2,
  moderate_intensity = 0.8,
  blur_intensity = 2,
  blur_saturation = 2,
  mean_intensity = 0.5,
  mean_saturation = 0.15,
  rotate_wheel = 30,
  endpoint = 100,
  lower_hue_threshold = 150,
  upper_hue_threshold = 330,
  saturation_limit_recolor = 0.15,
  mode = "test",
  verbose = TRUE
)

Arguments

path

Full path to main folder.

id

Unique ID of focal individual/respondent. Used if user wants to test colors by setting mode="test".

id_full

Full path to photograph. Used by remove_color_collisions function. Set to NA otherwise.

id_short

ID code plus .jpg extension. Used by remove_color_collisions. Set to NA otherwise.

mix_histogram

A scalar on (0,1) to mix orginal intensity and balanced histogram of intensity.

high_intensity_thresh

Limit at which to moderate overexposed areas.

low_intensity_thresh

Limit at which to lighten underexposed areas.

moderate_intensity

Scale factor with which we correct high and low intensity areas.

blur_intensity

Blur applied to intensity layer to smooth out threshold artifacts.

blur_saturation

Blur applied to saturation layer to smooth out threshold artifacts.

mean_intensity

Average intensity in final image.

mean_saturation

Average saturation in final image.

rotate_wheel

Angle to rotate color wheel before removing token colors. Its beter to start at slightly purple than red.

endpoint

Upper limit of hues after mapping.

lower_hue_threshold

Any hue above this, but below the upper threshold, will get mapped to the interval between 0 and endpoint.

upper_hue_threshold

Any hue below this, but above the lower threshold, will get mapped to the interval between 0 and endpoint.

saturation_limit_recolor

Saturation limit above which token colors are rotated out of image.

mode

Set to "test", to check photos by hand. The "save" option is used only by remove_color_collisions.

verbose

Set to TRUE to plot orginal and processsed images


ctross/DieTryin documentation built on Sept. 8, 2024, 8:07 p.m.