| Type: | Package |
| Title: | Turn Images into Data Sets |
| Version: | 1.0.1 |
| Description: | The goal of 'image2data' is to extract images and return them into a data set, especially for teaching data manipulation and data visualization. Basically, the eponymous function takes an image file ('png', 'tiff', 'jpeg', 'bmp') and turn it into a data set, pixels being rows (subjects) and columns (variables) being their coordinate positions (x- and y-axis) and their respective color (in hex codes). The function can return a complete image or a range of color (i.e., contour, silhouette). The data can then be manipulated as would any data set by either creating other related variables (to hide the image) or as a genuine toy data set. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.1.2 |
| Imports: | readbitmap (≥ 0.1.0) |
| NeedsCompilation: | no |
| Packaged: | 2022-08-22 18:59:37 UTC; pocar |
| Author: | P.-O. Caron |
| Maintainer: | P.-O. Caron <pocaron19@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2022-08-22 19:10:02 UTC |
Turn an image into data
Description
Extract an image file ("png", "tiff", "jpeg", "bmp") and turn it into an enjoyable data set, pixels being rows (subjects) and columns (variables) being their coordinate positions (x and y axis) and their respective color (in hex codes).
Usage
image2data(
path,
type = "fill",
scaling = "standardized",
showplot = TRUE,
reduce = 1,
A = 1,
R = c(0, 0.05),
G = c(0, 0.05),
B = c(0, 0.05),
Grey = NULL,
precision = 1,
seed = NULL
)
Arguments
path |
Path to image file. |
type |
Type of extraction of data. |
scaling |
Tranform the data to a specified scale. Three options are available : |
showplot |
Show a preliminary plot of the data (default is |
reduce |
|
A |
Transparency, otherwise known as |
R, G, B |
Color to return with |
Grey |
Grey range to be returned with |
precision |
Set precision of |
seed |
Set seed value for random pixel returned with |
Value
A data frame with pixels as rows and columns are x and y coordinates and g is their color in hex (factors).
Examples
path <- system.file(file.path("extdata", "success.png"), package = "image2data")
image2data(path = path, type = "line")
image2data(path = path, type = "line", Grey = c(0,.50))
## Not run:
image2data(path = file.choose())
## End(Not run)