In: Computer Science
Write code:
using R to combine two pictures into one picture and save it. For example put imagin1.png into image2.png and save it as imagin3.png.
R CODE TO COMBINE TWO PICTURES INTO A SINGLE IMAGE:
Description:
All images will be concatenated along the x,y,z, or c axis.
Usage:
1 |
imappend(imlist, axis) |
Arguments:
imlist |
a list of images (all elements must be of class cimg) |
axis |
the axis along which to concatenate (for example 'c') |
Examples:
1 2 3 4 5 6 7 |
imappend(list(boats,boats),"x") %>% plot imappend(list(boats,boats),"y") %>% plot purrr::map(1:3, ~imnoise(100,100)) %>% imappend("c") %>% plot boats.gs <- grayscale(boats) purrr::map(seq(1,5,l=3),function(v) isoblur(boats.gs,v)) %>% imappend("c") %>% plot #imappend also works on pixsets imsplit(boats > .5,"c") %>% imappend("x") %>% plot |
Example output |
Loading required package: magrittr Attaching package: 'imager' The following object is masked from 'package:magrittr': add The following objects are masked from 'package:stats': convolve, spectrum The following object is masked from 'package:graphics': frame The following object is masked from 'package:base': save.image