edger_single: Find and Recolor Contours in a Single Image

View source: R/edger_single.R

edger_singleR Documentation

Find and Recolor Contours in a Single Image

Description

Define a rectangular region and locate pixels with contour value greater than the one defined within the function. Then, recolor pixels and display recolored image.

Usage

edger_single(
  imagepath,
  roi = NULL,
  th = 20,
  regions = 1,
  shift = c(0, 0),
  rotate = 0,
  color = "red",
  save = FALSE
)

Arguments

imagepath

The file path to the image to be analyzed.

roi

An argument for delineating the region(s) of interest outside of the main function. Default is NULL and will launch a user interface so the user can draw a region(s) of interest on the image. If "roi" is not NULL, input should be a list containing a 4-column data frame with a number of rows equal to regions. The data frame needs to contain coordinates to the region(s) of interest in the following order: top-left x, top-left y, bottom-right x, bottom-right y. Note that plotting of images by "imager" starts in the top-left corner.

th

A numeric between 1-100 for the lowest contour value you want to recolor (a low contour value captures weaker contrasts). Default is 20.

regions

A numeric indicating how many regions to draw. Default is 1.

shift

A vector of length 2 containing numerics indicating the amount of shift along the x axis first and the y axis second. Positive values indicate shifts right or up, while negative values indicate shifts left or down. Default is c(0,0).

rotate

A numeric indicating the number of degrees to rotate the recolored pixels. Pixels are rotated around the center of the edge pixels. Default is 0.

color

A character string for the color of the superimposed object. Default is red.

save

Logical. Save the output image. Default is FALSE.

Value

The input data frame as an image.

A recolored image. If save == TRUE, saves recolored image to working directory with "_contourr" appended to the original name.


kaitlynstrickfaden/edger documentation built on Nov. 22, 2022, 5:55 a.m.