Skip to contents

Template definitions are lists that contain information about templates that are needed to do things like symmetrising and masking images. This function is mostly used internally.

Usage

tem_def(tem_id = "frl", path = NULL)

Arguments

tem_id

the name of a built-in template (frl, fpp106, fpp83, dlib70, or dlib7) or a numeric ID of a template to retrieve from webmorph.org

path

path of local tem definition file

Value

list with template definition

Details

If you have defined a custom template on webmorph.org, you can get its function definition by ID. You can see the ID numbers next to the templates available to you under the Template > Current Template menu.

Examples

fpp106 <- tem_def("fpp106")
fpp106$lines |> str()
#> List of 15
#>  $ : int [1:33] 2 3 4 5 6 7 8 9 10 11 ...
#>  $ : int [1:7] 86 87 88 89 90 91 92
#>  $ : int [1:7] 86 93 98 99 100 97 92
#>  $ : int [1:6] 86 94 95 96 97 92
#>  $ : int [1:7] 86 101 102 103 104 105 92
#>  $ : int [1:5] 35 36 37 38 39
#>  $ : int [1:5] 35 42 41 40 39
#>  $ : int [1:5] 44 45 46 47 48
#>  $ : int [1:5] 44 51 50 49 48
#>  $ : int [1:6] 53 54 55 56 57 58
#>  $ : int [1:5] 53 61 60 59 58
#>  $ : int [1:6] 62 63 64 65 66 67
#>  $ : int [1:5] 62 70 69 68 67
#>  $ : int [1:11] 75 76 77 78 79 80 81 82 83 84 ...
#>  $ : int [1:5] 71 72 73 74 80

# \donttest{
fpp83 <- tem_def("fpp83")
fpp83$mask |> str()
#> List of 8
#>  $ left_eye  :List of 2
#>   ..$ : int [1:5] 44 4 56 51 79
#>   ..$ : int [1:5] 79 58 11 25 44
#>  $ right_eye :List of 2
#>   ..$ : int [1:5] 61 67 38 34 40
#>   ..$ : int [1:5] 40 41 17 47 61
#>  $ nose      :List of 1
#>   ..$ : int [1:10] 70 71 54 78 37 77 33 74 59 70
#>  $ mouth     :List of 2
#>   ..$ : int [1:7] 29 0 3 26 72 42 45
#>   ..$ : int [1:7] 45 75 2 12 39 10 29
#>  $ teeth     :List of 2
#>   ..$ : int [1:5] 29 52 14 9 45
#>   ..$ : int [1:5] 45 46 82 1 29
#>  $ left_brow :List of 2
#>   ..$ : int [1:5] 32 62 68 80 48
#>   ..$ : int [1:5] 48 49 5 7 32
#>  $ right_brow:List of 2
#>   ..$ : int [1:5] 16 64 15 69 66
#>   ..$ : int [1:5] 66 43 55 8 16
#>  $ face      :List of 1
#>   ..$ : int [1:22] 24 23 22 21 20 19 18 53 13 6 ...

frl <- tem_def("frl")
frl$points[1:10, ]
#>    n                      name       x       y sym fpp106.x fpp106.y
#> 1  0                left pupil 165.659 275.234   1        0        0
#> 2  1               right pupil 284.339 275.231   0        1        1
#> 3  2          top of left iris 165.219 267.225  10       37       37
#> 4  3     top-left of left iris 155.781 269.909  17       NA       NA
#> 5  4         left of left iris 154.252 276.694  16       NA        0
#> 6  5  bottom-left of left iris 157.117 282.607  15       NA       NA
#> 7  6       bottom of left iris 165.507 286.083  14       41       41
#> 8  7 bottom-right of left iris 173.839 282.517  13       NA       NA
#> 9  8        right of left iris 176.720 276.472  12       NA        0
#> 10 9    top-right of left iris 175.040 270.366  11       NA       NA
viz_tem_def(frl, pt.size = 10, line.size = 5)

# }