I am an R and OpenCpu newbie. I have been able to create and deploy a simple R package with a function, and make a REST call to the function with curl get a json response.
I am using R 3.1.2 64 bit on Windows 7.
I now want to send an image file (say jpg or png) to an R function, process it and send back a response as text/json.
Is this possible with opencpu? What format and content-type should I be using?
I want to do something like:
curl -v http://server:port/ocpu/library/mylibrary/R/myimagefunc/<format?> -H "Content-Type: <content-type?>" <some_file.png>
This REST url would be embedded in a web application providing a file upload capability to the user.
------ Edit ------
aboutimage <- function(imageobj) {
require(RProtoBuf)
require(EBImage)
img <- readImage(imageobj)
nf <- numberOfFrames(img)
print(nf)
return(nf)
}
Thanks.