loading
 
Java Variables
Dave Zeegers from Netherlands  [1 posts]
15 year
Hello,
I will start with a small introduction, my name is Dave and I am currently working on a project at HAN University in Arnhem (Netherlands).
The goal of this project is to create an ambient intelligence environment, within this project we are integrating pattern recognition as well as movement detection (gesture recognition), and for these functionalities we want to make use of RoboRealm.

We did some experiments and were able to complete many tasks inside RoboRealm. Our next goal is to convert the variables from RoboRealm into Java so we can use java to create our own application to determine and execute the desired action. We have searched the RoboRealm site and found the API and Plugins (api.zip and plugins.zip). Within plugins.zip we found a good example of how to use java to obtain the variables from RoboRealm into java. After some trial and error we were able to understand the code and tried to extract variables other than height and width which were already present in the code.

We found a list of available variables (see screen) in the Socket Server Program module which we used to connect to our Java application. We then replaced the “height” in the code examples with variables like “mouse_click_y” and ”image_height”. When we tested our Java application we didn’t receive the results we expected, instead of the normal height in the example code (480) we received along (byte?) numbers and we can’t figure out what they mean or how to convert them into the actual values.

We are hoping someone knows a solution or can tell us what we are doing wrong and point us in the right direction, even entirely different approaches are welcome.

Working Example 1:
    if (name.equalsIgnoreCase("height"))
    {
      System.out.println(data);
      imageData.height = byteToInt(data);
      System.out.println(imageData.height);
    }
Output of example 1:
[B@addbf1
480
[B@addbf1
480
[B@addbf1
480
[B@addbf1
480
...


Adjusted Example:
    if (name.equalsIgnoreCase("image_height "))
    {
        System.out.println(data);
        int myIntVar = byteToInt(data);
        System.out.println(myIntVar);
    }


  
Anonymous 15 year
Dave,

The bytes that you are getting are 4 byte integer numbers. Remember that a byte (8 bits) can hold 0-255 whilst a 2 byte number can hold 0-65535, etc. A 4 byte number is the typical integer number used in most applications. In the case of the Socket based plugin that number is sent as 4 binary bytes as apposed to a text number since the plugins affect the pipeline directly and should be as efficient as possible.

Let me see if you are using the correct technique though. The Plugins are used to extend RoboRealm such that you create your own filter/module/logic etc. They are controlled by RoboRealm in terms of when they should execute and when they get created and/or deleted.

The API is a bit different and is meant for an external program to access the values created in RoboRealm. Most people interfacing to RoboRealm use this technique. It is also very different in terms of protocol as it uses only text to ensure that many languages can talk to RoboRealm. While it is possible to use any language as a Plugin most languages that are not very good at dealing with binary numbers (i.e. scripting languages) are not very efficient and will probably not be a good choice as a plugin. BUT as an API tool they are since the API only queries the state of RoboRealm and does NOT affect processing of an image in each pipeline iteration.

Hopefully this makes better sense as to when to use what.

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index