I have a question about ROI (metadataSDK)

Answered

Comments

11 comments

  • Avatar
    Andrey Terentyev

    Hello Aqua,

    ROI can be declared in Engine manifest and in Device agent manifest. They are displayed in GUI, when a plugin is enabled on a camera. Once the "Ok" or "Apply" button is pressed in GUI, actual settings values are passed to the Server, which passes values to a plugin.

    There are several ways to redeclare/override plugin setting values (including ROI):

    1. in getManifest of a device agent, when plugin is enabled on a camera;

    Your can "draw" new ROI by specifying new values and even new settings model in your plugin.

    2. in getPluginSideSettings of a device agent, which is called when plugin settings are going to be edited;

    The same as in 1.

    3. in doSetSettings of a device agent, when plugin settings are going to be saved.

    You can evaluated received setting values and recalculate your ROI.

    4. If you don't need to display any ROI, you can just skip declaration of ROI in you manifest files and calculate ROI inside your plugin as it is required by your objective.

    0
    Comment actions Permalink
  • Avatar
    Nx Support

    Regions of interests are supported in 4.1 version. Please, refer to the latest patch here: https://meta.nxvms.com/downloads/patches

    0
    Comment actions Permalink
  • Avatar
    Aqua Hsu

    Hi Andrey,

    Thank you.

    getPluginSideSettings is exactly the method that I want, but it still can’t work well with ROI. I have already tried the following string :

    1. setValue(testPolygon, "{\"figure\":{\"color\":\"#e040fb\",\"points\":[[0.2,0.2],[0.2,0.5],[0.9,0.6]]},\"label\":\"\",\"showOnCamera\":true}" );
    2. setValue(testPolygon, R”json({"figure":{"color":"#7c4dff","points":[[0.2,0.2],[0.2,0.5],[0.9,0.6]]},"label":"","showOnCamera":true})json" );
    0
    Comment actions Permalink
  • Avatar
    Aqua Hsu

    In addition, defaultValue  is work on ROI in the manifestString?

    0
    Comment actions Permalink
  • Avatar
    Aqua Hsu

    Give me some suggestions ヽ(`Д´)ノ 

    Please ( ´•̥̥̥ω•̥̥̥` )

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

     Hello Aqua,

    Let's consider example of using getPluginSideSettings from stub_analytics_plugin.

    voidDeviceAgent::getPluginSideSettings(
    Result<constISettingsResponse*>*outResult) const

    {
    const auto response = newSettingsResponse();
    response->setValue("pluginSideTestSpinBox", "100");
    *outResult = response;
    }

    As you can see, the method returns nothing, however initiates and manupulates the SettingsResponse class (see src/nx/sdk/helpers/settings_response.h) the setValue method of that is declared like this:

    void setValue(std::stringkey, std::stringvalue);

    The key parameter should contain a sting with either new setting name or a setting name declared in DeviceAgent manifest.

    The value parameter should contain a string with the value corresponding to key.I

    In your case the testPolygon should be a string, I suppose. Like this

    setValue("testPolygon", ....

     

     

     

    0
    Comment actions Permalink
  • Avatar
    Aqua Hsu

    testPolygon is a string variable in the manifestString that I create:

    {

    "type": "PolygonFigure",

    "name": ")json" + testPolygon + R"json(",

    "caption": "Polygon"

     }

    The problem that bothers me most is I can’t update the ROI value correctly and display it on the camera. Do I set the wrong format on stringvalue, or just it can’t really work with ROI?

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Aqua,

    > testPolygon is a string variable in the manifestString that I create:

    The testPolygon is a NAME of the setting. The setting has several properties which could be changed.

    In order to change the properties of the testPolygon setting,  you should pass the name in quotes - "testPolygon" and properties to be changed as JSON object.

    Try this

    setValue("testPolygon", "{\"figure\":{\"color\":\"#e040fb\",\"points\":[[0.2,0.2],[0.2,0.5],[0.9,0.6]]},\"label\":\"\",\"showOnCamera\":true}" );

     

    0
    Comment actions Permalink
  • Avatar
    Aqua Hsu

    Hi,

    I try that again as you said today, but it always return null from settingValue, and it can't display on camera.

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hi Aqua,

    I'm going to create a ticket to request additional details. Please check you email box for messages from our ticket system.

    On resolution the answer will be published in this thread.

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    The problem was solved by updating to the latest available build of MetaVMS.

    0
    Comment actions Permalink

Please sign in to leave a comment.