Create a dataframe of brick colors and sizes used in a brick mosaic or model.
build_pieces_table(brick_obj)
brick_obj | brickr mosaic or 3D model object. |
---|
Data frame of piece counts by LEGO color name and size.
Other Resources:
build_colors()
,
build_instructions()
,
build_pieces()
# Import a jpeg or png demo_file <- system.file("extdata", "demo_img.jpg", package = "brickr", mustWork = TRUE) demo_image <- jpeg::readJPEG(demo_file) #Create a mosaic oject # \donttest{ mosaic <- demo_image %>% image_to_mosaic(img_size = 24) # } #Rather than drawing the mosaic, use build_pieces_table() to produce piece table # \donttest{ mosaic %>% build_pieces_table()#> # A tibble: 24 x 8 #> Piece `LEGO Brick Color` `1 x 1` `2 x 1` `2 x 2` `3 x 1` `4 x 1` `4 x 2` #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 p Aqua 12 2 1 2 0 1 #> 2 p Br. yellowish green 3 0 0 0 1 0 #> 3 p Brick yellow 14 4 2 3 3 0 #> 4 p Bright green 0 2 1 0 0 0 #> 5 p Bright orange 3 1 0 0 0 0 #> 6 p Bright yellow 11 6 6 3 1 2 #> 7 p Cool yellow 6 3 0 0 0 0 #> 8 p Dark azur 1 1 0 0 0 0 #> 9 p Dark orange 5 4 2 2 1 1 #> 10 p Dark stone grey 2 1 0 0 1 0 #> # ... with 14 more rows# }