R/bricks-from-mosaic.R
bricks_from_mosaic.Rd
Stacks LEGO plates to create a 3D version of the 2D brick mosaics. Height of bricks determined by brightness of color.
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()
# 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 # \donttest{ mosaic <- demo_image %>% image_to_mosaic(24) # } #Pass the mosaic object to bricks_from_mosaic() to convert to 3D specifications # \donttest{ 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 # \donttest{ mosaic %>% bricks_from_mosaic(mosaic_height = 3, highest_el = "dark") %>% build_bricks() rgl::clear3d() # }