Skip to contents

This function is used to import outline coordinates and is built around import_jpg1.

Usage

import_jpg(
  jpg.paths = .lf.auto(),
  auto.notcentered = TRUE,
  fun.notcentered = NULL,
  threshold = 0.5
)

Arguments

jpg.paths

a vector of paths corresponding to the .jpg files to import. If not provided (or NULL), switches to the automatic version. See Details below.

auto.notcentered

logical if TRUE random locations will be used until. one of them is (assumed) to be within the shape (because of a black pixel); if FALSE a locator will be called, and you will have to click on a point within the shape.

fun.notcentered

NULL by default. Is your shapes are not centered and if a random pick of a black pixel is not satisfactory. See import_jpg1 help and examples.

threshold

the threshold value use to binarize the images. Above, pixels are turned to 1, below to 0.

Value

a list of matrices of (x; y) coordinates that can be passed to Out

Details

see import_jpg1 for important informations about how the outlines are extracted, and import_Conte for the algorithm itself.

If jpg.paths is not provided (or NULL), you will have to select any .jpg file in the folder that contains all your files. All the outlines should be imported then.

Note

Note this function will be deprecated from Momocs when Momacs and Momit will be fully operationnal.

Silent message and progress bars (if any) with options("verbose"=FALSE).

See also

Examples

# \donttest{

lf <- list.files('/foo/jpegs', full.names=TRUE)
coo <- import_jpg(lf)
#> Extracting 0.jpg outlines...
#> Done in 0 secs
Out(coo)
#> empty Out

coo <- import_jpg()
#> Warning: unable to translate '<d0><ff><ff><ff><ff><ff><ff><ff><c0><aa><ef>' to a wide string
#> Warning: input string 1 is invalid
#> Extracting 0.jpg outlines...
#> Done in 0 secs
# }