Description Usage Arguments Value See Also Examples
View source: R/bricks-from-mosaic.R
Stacks LEGO plates to create a 3D version of the 2D brick mosaics. Height of bricks determined by brightness of color.
1 | bricks_from_mosaic(mosaic_list, mosaic_height = 6, highest_el = "light")
|
mosaic_list |
List output from image_to_bricks(). Contains an element |
mosaic_height |
Number of layers in the 3D image. |
highest_el |
Brick height is determined by brightness of color. Use |
A list with elements Img_lego
to pass to build_bricks
.
Other 3D Models:
bricks_from_coords()
,
bricks_from_excel()
,
bricks_from_table()
,
build_bricks()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # Import a jpeg or png
demo_file <- system.file("extdata", "demo_img.jpg",
package = "brickr", mustWork = TRUE)
demo_image <- jpeg::readJPEG(demo_file)
#Begin with a 24x24 mosaic object
mosaic <- demo_image %>%
image_to_mosaic(24)
#Pass the mosaic object to bricks_from_mosaic() to convert to 3D specifications
mosaic %>%
bricks_from_mosaic() %>%
build_bricks()
rgl::clear3d()
#In this image, the background is a light color.
# Change the 'highest_el' to make dark colors highest
# Change mosaic height to change the number of layers
mosaic %>%
bricks_from_mosaic(mosaic_height = 3, highest_el = "dark") %>%
build_bricks()
rgl::clear3d()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.