README.md

This is an add-on package for imager to support out-of-memory video processing in R. This package should be considered experimental, meaning it's under-documented, under-tested, and I'm likely to tinker with the API. That said, it's still fun to play with, and which other R package will let you do statistics on what your face looks like on the webcam?

The package is based on OpenCV and CImg.

Features

Sample code

library(imagerstreams)
cam <- opencam() #Open a camera input stream
frames <- rlply(20,getFrame(cam)) #Grab the next 20 frames
#Denoise and play
llply(frames,blur_anisotropic,amplitude=10) %>% imappend("z") %>% play(loop=TRUE)
close(cam)

How to install

Imager-streams relies on OpenCV, which is Linux-friendly and everything-else-unfriendly. Unfortunately I don't know what to do about this problem at this stage. I'll try to provide binaries in the future (if possible). The package installs successfully on Linux and Mac OS X. It should run on Windows but I haven't tested it yet and you'll need to update Makevars.win. If you do manage to make it run please let me know.

Linux, Mac OS X

You need to install OpenCV first. Under Ubuntu/Mint:

sudo apt-get install libopencv-dev

should pull all the packages you'll need. For instructions on how to install OpenCV on OS X, see here.

Once you have the OpenCV headers and shared libraries you can compile and install the package using devtools:

library(devtools)
install_github("dahtah/imager")
install_github("dahtah/imagerstreams")

Windows

The following instuctions are just my best guess on how one should go about this. Grab the latest version of OpenCV, then make your own MinGW-compatible libraries following the instructions given here. Mingw ships with Rtools, so there should be no need to install it separately.

Download the package, and add a file called Makevars.win in the src/ directory with the following contents:

PKG_CPPFLAGS += -I"C:\opencv\build\include" 
PKG_LIBS +=  -L"C:\opencv\build\x86\mingw\lib"-lgdi32 -lopencv_core245 -lopencv_highgui245 $(RCPP_LDFLAGS)

The trailing digits are for version 2.4.5, replace with the appropriate figure. If needed replace C:\opencv with the actual directory you put OpenCV in. You should now be able to run R CMD install or devtools::install.



dahtah/imagerstreams documentation built on May 14, 2019, 3:27 p.m.