loading
 
Marco from Netherlands  [11 posts] 12 days
Hello to anyone who can help me.

I have an (old) roborealm file that I run on images.

Now i would like to start to use the API.

My goal is to have RoboRealm process an image (from file) when available and only do one run/processing on it.

Based on the C# API example I have build:
[code]
// result from some COM object functions
int VARIANT_TRUE = -1;
int VARIANT_FALSE = 0;

RR_COM_APILib.API_Wrapper rr = new API_Wrapper();
rr.SetCOMType(0);

{
    if (rr.Startup() == VARIANT_TRUE)
    {
        rr.Run("off");
        rr.LoadProgram("C:\run_test.robo");

        //rr.LoadImage("", "C:\test.jpg");
        rr.LoadImage("", "C:\test2.bmp");
        
        rr.Run("once");
        
        //rr.WaitImage();

        object nameArray = new object();
        object valueArray;
        int num = rr.GetAllVariables(ref nameArray, out valueArray);
        if (num > 0)
        {
            object[] names = (object[])nameArray;
            object[] values = (object[])valueArray;
            int i;
            for (i = 0; i < num; i++)
                Console.WriteLine(names[i] + "=" + values[i]);
        }

        rr.Disconnect();
        rr.Close();
    }
}
[/code]

This runs fine when using test.jpg, GetAllVariables() returns 109 variable objects.
According to RR runtime is 384ms and 10 blobs are found.

It fails though when I input test2.bmp
GetAllVariables() returns 0 objects.
But RR shows (and also debug output is written to files) all the variable objects.
According to RR runtime is 551ms and 282 blobs are found.

Uncommenting "rr.WaitImage();" doesnt change anything.

My gut feeling tells me "rr.Run("once");"is not a blocking operation.
But "rr.WaitImage();" doesnt change the outcome.

Does anybody have an idea why GetAllVariables() doesnt return anything in this case?
If more information is needed please let me know.

Cheers,
Marco

 Reply  New Post   Forum Index