Hi, I am sending bounding box metadata from our analytics service to the recording server. These are the pixel locations we send for a 1920 x 1080 resolution camera stream:
Bottom: 474.0457
Top: 166.4543
Left: 845.4543
Right: 1153.046
Those pixel locations seem reasonable to me. The bounding box does not show up when queueing metadata to the channel using the following code snippet (which sends those pixel values for the bounding box):
Vector dummyCenterOfGravity = new Vector { X = 0f, Y = 0f }; // Value used here does not seem to have any effect
};
Rectangle boundingBox = new Rectangle
{
Top = rocDetection.y - (rocDetection.height / 2.0f),
Left = rocDetection.x - (rocDetection.width / 2.0f),
Bottom = rocDetection.y + (rocDetection.height / 2.0f),
Right = rocDetection.x + (rocDetection.width / 2.0f),
LineColor = DisplayColor.ParseArgbString("#FFF0F8FF"),
FillColor = DisplayColor.ParseArgbString("#FFDC143C"),
LineDisplayPixelThickness = 1
};
//var description = new DisplayText
//{
// Value = "A square",
// FontFamily = "Helvetica",
// IsBold = false,
// IsItalic = false,
// Color = DisplayColor.ParseArgbString("#FFF0F8FF"),
// Size = 0.05f,
// CenterX = 0,
// CenterY = 0
//};
Transformation transformation = new Transformation
{
Translate = new Vector { X = 0.0f, Y = 0.0f },
Scale = new Vector { X = 0.003125f, Y = 0.00416667f }
};
metadataFlow.Post(new CameraAnalyticsData // Post simply queues metadata
{
CameraGuid = mipCamera.FQID.ObjectId,
AnalyticsMetadata = new VideoOS.Platform.Metadata.MetadataStream
{
VideoAnalyticsItems =
{
new VideoAnalytics
{
Frames =
{
new Frame(DateTime.UtcNow)
{
Objects =
{
new OnvifObject(1)
{
Appearance = new VideoOS.Platform.Metadata.Appearance
{
Shape = new Shape
{
BoundingBox = boundingBox,
CenterOfGravity = dummyCenterOfGravity
},
//Description = description,
//TODO: This has an effect but can't tell how it works?
//Transformation = transformation
}
}
}
}
}
}
}
}
});
Trying various combinations of commenting/uncommenting the Transformation object, I can get the bounding box to show up in seemingly random places all over the camera view. Could you please point out if I’m doing something obviously wrong, or to an in-depth description of how the different properties of VideoOS.Platform.Metadata.OnvifObject (Appearance and Behavior) are used to draw the bounding box overlay? The VideoOS.Platform.Metadata.Shape class does not have very much description and most of the examples such as BoundingBoxMetadataProvider, MultiChannelMetadataProvider, or “Introduction to Metadata” use proportions of the camera image (values less than 1.0) rather than pixel values (values greater than 1.0) to draw the bounding box.