
Convert CPCe coordinates to image pixel coordinates
convert_cpce_coords.RdConverts point coordinates from the CPCe coordinate space to actual image pixels by proportional scaling. Original CPCe coordinates are preserved.
Usage
convert_cpce_coords(
points,
cpce_width = NULL,
cpce_height = NULL,
image_width = NULL,
image_height = NULL
)Arguments
- points
A data frame with
cpce_xandcpce_ycolumns.- cpce_width, cpce_height
CPCe coordinate-space width and height. If
NULL, the function usespoints$cpce_widthandpoints$cpce_height.- image_width, image_height
Image width and height in pixels. If
NULL, the function usespoints$image_widthandpoints$image_height.
Examples
pts <- tibble::tibble(cpce_x = c(0, 50, 100), cpce_y = c(0, 25, 50))
convert_cpce_coords(pts, 100, 50, 1000, 500)
#> # A tibble: 3 × 8
#> cpce_x cpce_y cpce_width cpce_height image_width image_height x_px y_px
#> <dbl> <dbl> <dbl> <dbl> <int> <int> <int> <int>
#> 1 0 0 100 50 1000 500 0 0
#> 2 50 25 100 50 1000 500 500 250
#> 3 100 50 100 50 1000 500 1000 500