Define Object Dimensions
This section describes how to define known dimensions for objects that appear in the scene. You must do this if you want to:
- automatically calculate the projection matrix, as described in Define the Perspective, rather than setting the
Projection
parameter based on real-world measurements of the scene. - reduce the number of false positive results, by checking whether the size of an object, in pixels, corresponds to the real-world size of such an object at the relevant distance from the camera.
You can define the dimensions of objects in a metadata field in your training database, or directly in your session configuration file.
Define Dimensions in the Database
OpenText recommends setting object dimensions in your training database, so that the information can be shared between session configurations and across Media Server installations. The following table describes how to do this.
Analysis engine | Requirements |
---|---|
Object class recognition | Add a metadata field to each class in your recognizer, using the action AddObjectClassMetadata . |
Vehicle model recognition | Add a metadata field to each vehicle model in your vehicle database, using the action AddVehicleModelMetadata . |
The metadata field must contain three numbers - the height, length, and width of the object (in that order, separated by spaces). You can use any units, but you do not specify the units and you must use the same units for all perspective features.
The following action defines dimensions for an object class "car" in a recognizer named "MyRoadUsersRecognizer". The action adds a metadata field named dimensions(m)
and specifies the dimensions as 1.55m high, 4.5 m long, and 1.9m wide.
curl http://localhost:14000/action=AddObjectClassMetadata -F recognizer=MyRoadUsersRecognizer -F identifier=car -F key=dimensions(m) -F value="1.55 4.5 1.9"
After setting the expected size for each object class or vehicle model, add the parameter WorldDimensionsMetadata
to your session configuration. This specifies the name of the metadata field that you added. The following example shows an object class recognition task, but this parameter is also available for vehicle model recognition:
[ObjectClassRecognition] Type=ObjectClassRecognition Recognizer=MyRoadUsersRecognizer WorldDimensionsMetadata=dimensions(m)
Define Dimensions in the Session Configuration
To define dimensions in your session configuration, set the parameter WorldDimensions
. Dimensions set in a session configuration override dimensions set in the database for the same object class or vehicle model.
The value of the WorldDimensions
parameter is the name of an object class or vehicle model, followed by a colon, followed by the height, length, and width of the object (in that order). You can use any units, but you do not specify the units and you must use the same units for all perspective features.
The following example shows an object class recognition task:
[ObjectClassRecognition] Type=ObjectClassRecognition Recognizer=MyRoadUsersRecognizer WorldDimensions0=car: 1.55 4.5 1.8 WorldDimensions1=van: 2.3 5.8 2.1 WorldDimensions2=hgv: 3.7 18 2.5
With vehicle model recognition, you can also specify dimensions for the vehicle types that are returned by the analysis engine (for example, bus
, car
, motorcycle
, or truck
). These dimensions are used when the vehicle type is recognized but the model is not. The following example sets dimensions for two vehicle models and the vehicle type "car":
[VehicleModelRecognition] Type=VehicleModel Database=SomeVehicleModels WorldDimensions0=car: 1.55 4.5 1.8 WorldDimensions1=mustang: 1.38 4.78 1.92 WorldDimensions2=focus: 1.5 4.4 1.8