image_align {pliman} | R Documentation |
Aligns an Image
object by hand
Description
image_align()
rotate an image given a line of desired aligment along the y
axis that corresponds to the alignment of the objects (e.g., field plots). By
default, the aligment will be to the vertical, which means that if the drawed
line have an angle < 90ยบ parallel to the x axis, the rotation angle wil be
negative (anticlocwise rotation).
Usage
image_align(
img,
align = c("vertical", "horizontal"),
viewer = get_pliman_viewer(),
plot = TRUE
)
Arguments
img |
An |
align |
The desired alignment. Either |
viewer |
The viewer option. If not provided, the value is retrieved
using |
plot |
Plots the aligned image? Defaults to |
Details
The image_align
function aligns an image along the vertical or horizontal
axis based on user-selected points. The alignment can be performed in either
the base plotting system or using the mapview package for interactive
visualization. If the viewer option is set to "base", the function prompts
the user to select two points on the image to define the alignment line. If
the viewer option is set to "mapview", the function opens an interactive map
where the user can draw a polyline to define the alignment line. The
alignment angle is calculated based on the selected points, and the image is
rotated accordingly using the image_rotate
function. The function returns
the aligned image object.
Value
The img
aligned
Examples
if(interactive()){
library(pliman)
flax <- image_pliman("flax_leaves.jpg", plot = TRUE)
aligned <- image_align(flax)
}