1 문제점

1.1 사진속 인물

library(tidyverse)
library(magick)

LJM <- image_read("fig/LJM_profile.jpg")

LJM_resized <- LJM %>% 
  image_resize("100")

LJM_resized

1.2 배경 사진

road <- image_read("fig/road.jpg")

road_resized <- road %>% 
  image_resize("500")

road_resized

1.3 두 이미지 합성

road_resized %>% 
  image_composite(LJM_resized,
                  offset = "+400+200")

2 배경 투명하게

LJM_tranparent <- LJM_resized %>% 
  image_transparent(color = "#EAEEF0")
road_resized %>% 
  image_composite(LJM_tranparent,
                  offset = "+400+200")

3 마스킹 사례

dog_img <- image_read_svg("http://www.supercoloring.com/sites/default/files/silhouettes/2015/05/cairn-terrier-black-silhouette.svg")

dog_transparent <- dog_img %>% 
  image_transparent('white')

image_append(c(dog_img %>% image_resize(200), 
               dog_transparent %>% image_resize(200),
               road_resized %>% image_resize(300)))

dog_img %>% 
  image_transparent('white') %>% 
  image_resize(300) %>% 
  image_composite(road_resized)

4 이미지 윤곽

library(imager)

LJM_resized %>% 
  image_background("blue") %>% 
  image_border( color = "red")

LJM_imager <- magick2cimg(LJM_resized, alpha="flatten")

LJM_imager
Image. Width: 100 pix Height: 133 pix Depth: 1 Colour channels: 3 
 

데이터 과학자 이광춘 저작

kwangchun.lee.7@gmail.com