Shape Target Training
Preparation
Before training Shape targets, prepare an image of the target in one of the following formats:
- .jpg/jpeg
- .png
- .bmp
A good Shape target will have certain visual features that enable accurate pose estimation and stable tracking:
Properties | Explanation |
---|---|
Distinctive pattern | Texture with many distinctive visual features (e.g. corners, blobs) |
Rich texture | Texture with rich visual features all over the image without empty regions |
No repetitive pattern | Textures with no similar patterns repeating |
Non-reflective | The object itself should not be reflective |
Shape target training
Shape target training requires 4 arguments:
- Output directory
- Input configuration (e.g. ShapeTargetTrainingConfig.json)
- Input image file
- Camera calibration (camera used to generate the input image file)
The input configuration differs according to the actual shape of the target:
Plane shape target
ShapeTargetTrainingConfig.json
{
"Config.Target.Type": "Shape",
"Config.Target.Name": "Utah_billboard",
"Shape.PrimitiveModel.Type": "Plane",
"Shape.PlaneModel.Vertices": [ 24, 10, 493, 108, 497, 335, 22, 325 ],
"Shape.PrimitiveModel.PhysicalSize": [ 2.35, 1.10, 0.0 ]
}
Shape.PlaneModel.Vertices
The vertices of the Plane shape need to be declared in absolute pixel coordinates of the input image.
The order is as follows: P1.x, P1.y, P2.x, P2.y, P3.x, P3.y, P4.x, P4.y
Shape.PrimitiveModel.PhysicalSize
The physical size of the object needs to be defined in meters.
Always declare the last value as 0.0
.
Box shape target
BoxTargetTrainingConfig.json
{
"Config.Target.Type": "Shape",
"Config.Target.Name": "Wooden_box",
"Shape.PrimitiveModel.Type": "Box",
"Shape.BoxModel.Vertices": [ 68, 174, 350, 16, 562, 93, 546, 229, 308, 456, 96, 320, 301, 299 ],
"Shape.PrimitiveModel.PhysicalSize": [ 0.118, 0.082, 0.053 ]
}
Shape.PlaneModel.Vertices
The vertices of the Box shape need to be declared in absolute pixel coordinates of the input image.
The order is as follows: P1.x, P1.y, P2.x, P2.y, P3.x, P3.y, P4.x, P4.y, P5.x, P5.y, P6.x, P6.y, P7.x, P7.y
Shape.PrimitiveModel.PhysicalSize
The physical size of the object needs to be defined in meters.
Info
Currently the Box shape target only supports the perspective given in the sample.
Cylinder shape target
CylinderTargetTrainingConfig.json
{
"Config.Target.Type": "Shape",
"Config.Target.Name": "Campbells",
"Shape.PrimitiveModel.Type": "Cylinder",
"Shape.CylinderModel.Vertices": [ 191, 48, 312, 35, 445, 54, 188, 410, 317, 431, 440, 415 ],
"Shape.PrimitiveModel.PhysicalSize": [ 0.037, 0.120, 0.000 ]
}
Shape.CylinderModel.Vertices
The vertices of the Cylinder shape need to be declared in absolute pixel coordinates of the input image.
The order is as follows: P1.x, P1.y, P2.x, P2.y, P3.x, P3.y, P4.x, P4.y, P5.x, P5.y, P6.x, P6.y
Shape.PrimitiveModel.PhysicalSize
The physical size of the object needs to be defined in meters, corresponding to this order:
- Radius of cylinder
- Height of cylinder
- Always keep
0.0
for the last parameter
Cylinder model training supports all common types of perspectives: