R/ssdUtilities.R
convertCoordinates.Rd
Function for converting box coordinates to/from min/max representation from/to centroids/width
convertCoordinates(boxes, type = c("minmax2centroids", "centroids2minmax"))
boxes | A vector or 2-D array where each row corresponds to a single box consisting of the format (xmin,xmax,ymin,ymax) or (centerx,centery,width,height) for 2-D vs. (xmin,xmax,ymin,ymax,zmin,zmax) or (centerx,centery,centerz,width,height,depth) for 3-D. |
---|---|
type | either |
a vector or 2-D array with the converted coordinates
Tustison NJ
#> [1] 5.5 5.5 9.0 9.0convertCoordinates(vec2d, type = "centroids2minmax")#> [1] 0.5 1.5 5.0 15.0#> [,1] [,2] [,3] [,4] #> vec2d 5.5 5.5 9 9 #> vec2d 5.5 5.5 9 9 #> vec2d 5.5 5.5 9 9#> [,1] [,2] [,3] [,4] #> vec2d 0.5 1.5 5 15 #> vec2d 0.5 1.5 5 15 #> vec2d 0.5 1.5 5 15#> [1] 5.5 5.5 5.5 9.0 9.0 9.0convertCoordinates(vec3d, type = "centroids2minmax")#> [1] -4.0 6.0 9.5 10.5 -4.0 6.0#> [,1] [,2] [,3] [,4] [,5] [,6] #> vec3d 5.5 5.5 5.5 9 9 9 #> vec3d 5.5 5.5 5.5 9 9 9 #> vec3d 5.5 5.5 5.5 9 9 9#> [,1] [,2] [,3] [,4] [,5] [,6] #> vec3d -4 6 9.5 10.5 -4 6 #> vec3d -4 6 9.5 10.5 -4 6 #> vec3d -4 6 9.5 10.5 -4 6