Simon Barthelmé (GIPSA-lab, CNRS)
If you’re on OS X, you’re probably missing XQuartz: https://www.xquartz.org/. Otherwise, you’re probably attempting to compile from source. If you’re installing from github, try installing from CRAN (install.packages(‘imager’)). If CRAN can’t find binaries for your platform:
imager by itself can only load images in png, jpeg and bmp format. Install ImageMagick for more. If you want to load videos, install ffmpeg.
imager doesn’t do out-of-memory processing, meaning the whole video gets loaded. Videos take up huge amounts of memory. If you really want to muck around with large videos, try the experimental package imagerstreams, which supports out-of-memory processing.
Try iminfo (needs imagemagick).
For overlaying, see imdraw:
load.example("parrots") %>% imdraw(boats,opacity=.5) %>% plot
For stacking, use imappend:
a <- load.example("parrots")
b <- boats
list(a,b) %>% imappend("x") %>% plot
For more flexibility, you can also pad the image and use imdraw.
Use permute_axes:
permute_axes(boats,"yxzc") %>% plot
See here.
Not really. There’s some very preliminary support in plot, and as.raster, and some reductions, but the limiting factor is that the underlying library does not support NAs at all. Some functions work, others don’t. So if you do have NAs in your data, your best bet is to get rid of them as soon as possible using interpolation. Another solution is to fill in zeros, and keep track of invalid areas using pixel sets. It’s partially a hack.
##Which areas are valid after a box blur?
im <- grayscale(boats)
im[1:2000] <- NA
plot(im,col.na="red")
nas <- px.na(im)
##Fill in with zeros
im[nas] <- 0
out <- boxblur(im,10)
##Invalid pixels have contributions from NA values.
invalid <- boxblur(nas,10) > 1e-16
#We use 1e-16 instead of strict zero because of numerical precision issues
plot(out)
highlight(invalid)
I’m definitely interested in having better NA support, if only in the form of an optional ‘NA-safe’ mode that scans for NAs before attempting any unsafe operations. If you’re interested in contributing to imager, get in touch.