Run with matrix + image in R