The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
The getAffineTransform() and warpAffine() functions of the OpenImageR package is an RcppArmadillo re-implementation of existing Python Code and this vignette shows how these functions can be used from within R based on the author’s .ipynb file
require(OpenImageR)
= system.file('tmp_images', 'landscape.jpg', package = "OpenImageR")
path
= readImage(path)
img print(dim(img))
## [1] 600 600 3
= ncol(img)
r = nrow(img)
c = 50
offset
= matrix(data = c(0, 0, r, 0, 0, c),
original_points nrow = 3,
ncol = 2,
byrow = TRUE)
= matrix(data = c(offset, 0, r, offset, 0, c-offset),
transformed_points nrow = 3,
ncol = 2,
byrow = TRUE)
= getAffineTransform(original_points = original_points,
M_aff transformed_points = transformed_points)
The following is the Affine transformation matrix,
print(M_aff)
## [,1] [,2] [,3]
## [1,] 0.91666667 -0.08333333 50
## [2,] 0.08333333 0.91666667 0
The Affine transformation matrix can be used as input in the warpAffine() function,
= warpAffine(img = img,
res_3d M = M_aff,
R = r,
C = c,
verbose = TRUE)
## time to complete : 0.0644 secs
str(res_3d)
## num [1:600, 1:600, 1:3] 0 0 0 0 0 0 0 0 0 0 ...
The next image shows the output based on the input data and parameters,
imageShow(res_3d, clear_viewer = FALSE)
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.