I want to find a entropy for an image using R programming with the help of Asp.Net.I have downloaded and install the statconnDCOM to there default location.i'm using following assembly
using STATCONNECTORCLNTLib;
using StatConnectorCommonLib;
using STATCONNECTORSRVLib;
My C# code is
    static StatConnector rconn;
    static void Main(string[] args)
    {
        try
        {
            //Calculate Statistics in R
            rconn.Init("R");
            rconn.Evaluate("require(indicoio)");
            rconn.Evaluate("require(jpeg)");
            rconn.Evaluate("imgPath<-C:/Users/Sunil/Desktop/apple2.jpg");
            //Read the image into a raster array
            rconn.Evaluate("img<-readJPEG(imgPath, native = FALSE)");
            //convert the array to a data.frame or matrix
            rconn.Evaluate("mystring<-as.data.frame(img)");
            rconn.Evaluate("myfreqs <- mystring / sum(mystring)");
            //vectorize
            rconn.Evaluate("myvec <- as.data.frame(myfreqs)[,2]");
            // H in bit
            double average = (double)rconn.GetSymbol(rconn.Evaluate("-sum(myvec * log2(myvec))"));
            Console.WriteLine("Entropy is: " + average);
            Console.ReadLine();           
        }
        catch(Exception ex)
        {
            Console.WriteLine("Error: " + ex);
            Console.ReadLine();
        }
 
    