image_shp {pliman} | R Documentation |
Construct a shape file from an image
Description
Creates a list of object coordinates given the desired number of nrow and
columns. It starts by selecting 4 points at the corners of objects of
interest in the plot space. Then, given nrow
and ncol
, a grid is drawn
and the objects' coordinates are returned.
Usage
image_shp(
img,
nrow = 1,
ncol = 1,
buffer_x = 0,
buffer_y = 0,
interactive = FALSE,
viewer = get_pliman_viewer(),
col_line = "red",
size_line = 2,
col_text = "red",
size_text = 1,
plot = TRUE
)
Arguments
img |
An object of class |
nrow |
The number of desired rows in the grid. Defaults to |
ncol |
The number of desired columns in the grid. Defaults to |
buffer_x , buffer_y |
Buffering factor for the width and height, respectively, of each individual shape's side. A value between 0 and 0.5 where 0 means no buffering and 0.5 means complete buffering (default: 0). A value of 0.25 will buffer the shape by 25% on each side. |
interactive |
If |
viewer |
The viewer option. If not provided, the value is retrieved
using |
col_line , col_text |
The color of the line/text in the grid. Defaults to
|
size_line , size_text |
The size of the line/text in the grid. Defaults to
|
plot |
Plots the grid on the image? Defaults to |
Value
A list with row * col
objects containing the plot coordinates.
Examples
library(pliman)
flax <- image_pliman("flax_leaves.jpg")
shape <- image_shp(flax, nrow = 3, ncol = 5)