Creating multiple bounding boxes dynamically

We have a String With multiple lines for each camera.

Sample: "This is sample text1

This is sample text2

This is sample text3

..

.."

Now we are displaying these lines in a single bounding box with single text color.

What we actually want is Each Line in the string should be displayed with different colors.(line1:Red,line2:Green,line3:Yellow,..).

The number of text in the string are generated dynamically for each camera and based on the text the color have to be decided.

So the bounding boxes for each camera have to be differs in count and color.

How can we achieve this?

Here we have attached the screenshots of what we have done.

I experimented with the Bounding Box sample, and I changed the color of the text of the staticObject (Appearance.Description) and that worked, and I have two texts.

Next experiment tried to remove first the Shape from the Appearance, and then remove the BoundingBox from the Shape, in both cases the Description text does not display.

The workaround is to submit a second (dummy/invisible) BoundingBox when you need a second text in order to conform to the Bounding Box understood and displayed by the Smart Client.

we have created the same static object but it does not work for multiple bounding box because we need something that the text is dynamically changing for all cameras.Can we create multiple onvif object inside the metadata.we have tried that also but it is taking that object as static.we cannot change the text dynamically for each camera.

here i have the code,

var metadata = new MetadataStream

  {

    VideoAnalyticsItems =

    {

      new VideoAnalytics

      {

        Frames =

        {

          new Frame(DateTime.UtcNow)

          {

            Objects =

            {

              new OnvifObject(objectId)

              {

                Appearance = new Appearance

                {

                  Shape = new Shape

                  {

                    BoundingBox = boundingBox,

                    CenterOfGravity = dummyCenterOfGravity

                  },

                 Description=description

                }

              },

new OnvifObject(objectId)

              {

                Appearance = new Appearance

                {

                  Shape = new Shape

                  {

                    BoundingBox = boundingBox,

                    CenterOfGravity = dummyCenterOfGravity

                  },

                 Description=description

                }

              }

            }

          }

        }

      }

    }

  };

You are using the same describtion object twice, I would guess you need multiple. When updating the text you would then resend the whole set of Objects even if only one of the Description was changed.

I hope it makes sense, if the answer does not fit I might have misunderstood, in that case please elaborate..

It is for sample we sent.The actual we are sending like two bounding box with different two different description text .

The code is like this.

int objectId1=1,objectId2=2;

description1=“This is sample text1”

description2=“This is sample text2”

var metadata = new MetadataStream

  {

    VideoAnalyticsItems =

    {

      new VideoAnalytics

      {

        Frames =

        {

          new Frame(DateTime.UtcNow)

          {

            Objects =

            {

              new OnvifObject(objectId)

              {

                Appearance = new Appearance

                {

                  Shape = new Shape

                  {

                    BoundingBox = boundingBox,

                    CenterOfGravity = dummyCenterOfGravity

                  },

                 Description=description1

                }

              },

new OnvifObject(objectId2)

              {

                Appearance = new Appearance

                {

                  Shape = new Shape

                  {

                    BoundingBox = boundingBox,

                    CenterOfGravity = dummyCenterOfGravity

                  },

                 Description=description2

                }

              }

            }

          }

        }

      }

    }

  };

But if i create like this second object with some dynamically changing description the smart client is crashing.

I think you are then missing

description1.Color = DisplayColor.ParseArgbString(“[66bdb76b](javascript:void(0); “66bdb76b”)”);

description2.Color = DisplayColor.ParseArgbString(“[fff0f8ff](javascript:void(0); “fff0f8ff”)”);

Setting the individual colors

Does it fit?

Thanks for your help, we got the solution.