mirror of
https://github.com/ryantimpe/brickr.git
synced 2026-01-06 05:39:34 -06:00
Initial work on vignettes and bricks_from_rayshader()
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -65,3 +65,4 @@ forestweb.mp4
|
||||
test_*
|
||||
brickr.Rproj
|
||||
brickr_colors.png
|
||||
inst/doc
|
||||
|
||||
@@ -20,7 +20,9 @@ Imports:
|
||||
scales,
|
||||
farver
|
||||
Suggests:
|
||||
rayshader
|
||||
rayshader,
|
||||
knitr,
|
||||
rmarkdown
|
||||
Roxygen: list(markdown = TRUE)
|
||||
RoxygenNote: 6.1.1
|
||||
URL: https://github.com/ryantimpe/brickr
|
||||
@@ -45,3 +47,4 @@ Collate:
|
||||
'theme_brick.R'
|
||||
'utils-pipe.R'
|
||||
'view_image.R'
|
||||
VignetteBuilder: knitr
|
||||
|
||||
@@ -125,7 +125,7 @@ scaled_to_colors <- function(image_list, method = "cie94",
|
||||
#Standard or dithering
|
||||
if(!dithering){
|
||||
img <- convert_color_to_brick_standard(in_list$Img_scaled, color_table, brick_table,
|
||||
color_palette, method)
|
||||
color_palette, method, contrast)
|
||||
} else {
|
||||
img <- convert_color_to_brick_dithering(in_list$Img_scaled, color_table, brick_table,
|
||||
color_palette, method)
|
||||
@@ -141,7 +141,7 @@ scaled_to_colors <- function(image_list, method = "cie94",
|
||||
|
||||
}
|
||||
|
||||
convert_color_to_brick_standard <- function(img_object, color_table, brick_table, color_palette, method){
|
||||
convert_color_to_brick_standard <- function(img_object, color_table, brick_table, color_palette, method, contrast){
|
||||
#Standard bricks ----
|
||||
# Two condition... not-supplied color_table & standard palette - or - a supplied color_table
|
||||
if((is.null(color_table) & any(c("universal", "generic", "special") %in% color_palette)) |
|
||||
@@ -229,6 +229,8 @@ convert_color_to_brick_dithering <- function(img_object, color_table, brick_tabl
|
||||
dith_diff <- mosaic_base[mosaic_base$x == xx & mosaic_base$y == yy, c("R", "G", "B")] -
|
||||
brick_table[which.min(dstncs), c("R_lego", "G_lego", "B_lego")]
|
||||
|
||||
# dith_diff <- dith_diff*c(0.299, 0.587, 0.114)
|
||||
|
||||
#Update color of surrounding pixels.. if pixel exists
|
||||
if(xx < max(mosaic_base$x)){
|
||||
xs <- 1; ys <- 0;
|
||||
|
||||
Reference in New Issue
Block a user