import_jpg: Extracts outline coordinates from multiple .jpg files

Description Usage Arguments Details Value See Also Examples

View source: R/babel-import.R

Description

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

Usage

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

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.

verbose

whether to print which file is being treated. Useful to detect problems.

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 taht contains all your files. All the outlines should be imported then.

Value

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

See Also

Other babel functions: bind_db, chc2Out, chc2pix, import_StereoMorph_curve1, import_tps, nef2Coe, ntsrow2Coo, pix2chc, tie_jpg_txt, tps2coo

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 

# if your images are in the folder '/foo/jpgs/'
lf <- list.files('/foo/jpegs', full.names=TRUE)
coo <- import_jpg(lf)
Out(coo)

# 'automatic' version
coo <- import_jpg()

## End(Not run)

Momocs documentation built on Sept. 28, 2017, 9:04 a.m.