I want to pass image from C# to R. I'm uploading my image using FileUpload and storing it into a folder "images".When i'm passing images location to R it gives me error. So,can you guys suggest me any alternate way to solve this error.Following are my code.
// Get Filename from fileupload control
string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
engine.Evaluate("imgPath<-'~/images/filename'"); //error in this line
// Read the image into a raster array
engine.Evaluate("img<-readJPEG(imgPath, native = FALSE)");
// convert the array to a data.frame
engine.Evaluate("mystring<-as.data.frame(img)");
engine.Evaluate("myfreqs <- mystring / sum(mystring)");
// vectorize
engine.Evaluate("abc <- as.data.frame(myfreqs)[,2]");
// create input matrices
engine.Evaluate(@"a <- matrix(c(abc), nrow=4)");