Learn R Programming

Momocs (version 1.1.6)

chc2Out: Converts chain-coded coordinates to Out object

Description

For Shape/ChainCoder files, a wrapper to convert chain-coded coordinates to Out objects.

Usage

chc2Out(chc, skip, names)

Arguments

chc
a path to the chc file
skip
numeric how many informations before the first chain-coded information
names
an (optional) vector of (skip) names for the fac created. Somehow similar to names in lf_structure

Details

Files from Shape/ChainCoder comes this way:
Name_1 fac1 fac2 fac3 [...] 6 6 6 6 6 6 6 6 7 6 [...] -1
Name_2 fac1 fac2 fac3 [...] 6 6 6 6 5 5 7 6 7 6 [...] -1
This function does the following:
  1. take everything before the first chain-coded coordinate (here a "6") and transform it into a data.frame, later used as a fac
  2. convert all the chain-coded coordinates into (x; y) coordinates using chc2pix (and removes) the "-1" that mark the end of coordinates
  3. returns an Out object with the corresponding fac and with outlines named after the first fac column (here with Name_1, Name_2, etc.)
This function needs to know how many information (space-separated there is before) the first coordinate. On the example above, would be 4 id [...] was empty.

References

Kuhl, F. P., & Giardina, C. R. (1982). Elliptic Fourier features of a closed contour. Computer Graphics and Image Processing, 18(3), 236-258.

See Also

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

Examples

Run this code
## Not run: ------------------------------------
# # if the file above was called 'coded.chc' in the 'data' folder:
# chc2Out("data/coded.chc", skip=4)
## ---------------------------------------------

Run the code above in your browser using DataLab