Is the Nx Cloud up? Visit our Status Page for the current health and performance of the Nx Cloud.

Status Page

Custom image in event MetadataPacket

Answered

Comments

1 comment

  • Andrey Terentyev
    • Network Optix team

    Hello Ashot,

    There is an setImage() function for ObjectTrackBestShotPacket class (which was not available in previous version of sdk) and currently I'm trying to use that function but I have no idea about setImage() function input parameters format which are imageDataFormat string and imageData vector.

    There is a stub_analytics_plugin in the Metadata SDK. See the "samples" folder.

    The DeviceAgent::cookSomeObjects() uses the setImage() method.

    if (!m_deviceAgentSettings.previewImageUrl.empty())
    {
    bestShotPacket->setImageUrl(m_deviceAgentSettings.previewImageUrl);
    }
    else if (!m_deviceAgentSettings.previewImage.empty()
    && !m_deviceAgentSettings.previewImageFormat.empty())
    {
    bestShotPacket->setImage(
    m_deviceAgentSettings.previewImageFormat,
    m_deviceAgentSettings.previewImage);
    }

    The setImage() method is defined in the src/nx/sdk/analytics/helpers/object_track_best_shot_packet.cpp

    void ObjectTrackBestShotPacket::setImage(std::string imageDataFormat, std::vector<char> imageData)
    {
        setImageDataFormat(std::move(imageDataFormat));
        setImageData(std::move(imageData));
    }

    As you can see the first parameter imageDataFormat is just a string containing a format identifier.

    The list of possible format identifier is introduced in the documentation of the IObjectTrackBestShotPacket1 interface class.

    /**
    * @return Format of the best shot image which is provided via imageData(). Can contain one of
    * the following values: "image/jpeg", "image/png", "image/tiff" for JPEG, PNG and TIFF
    * images correspondingly. If no image data is provided should return null.
    */
    virtual const char* imageDataFormat() const = 0;

    That's bad of us. We'll correct the docs.

    The imageData parameter is a vector of char, i.e. a vector of bytes that contains picture binary data, in other words a file of a picture in the format indicated in the imageDataFormat parameter.

    0

Please sign in to leave a comment.