Generate Template Image

Description

This operator automatically generates a corresponding 2D grayscale image template based on the geometric shape type (such as rectangle, circle, text, etc.) selected by the user and the specified dimension parameters. It utilizes the input camera intrinsics and the height range of the object from the camera to convert millimeter (mm) dimensions in the real world into pixel dimensions in the image, thereby creating a dimensionally accurate template image.

Overview

Generates a grayscale shape template at the selected camera scale.

Scenarios

This operator can be used to quickly generate a standard template when 2D vision algorithms based on template matching are required, but an actual captured template image is not available. For example, given the known standard geometric shape and dimensions of an object to be identified (such as a circular part with a diameter of 50mm, or a rectangular packaging box with a length of 100mm and width of 50mm), this operator can be used to generate the corresponding template image for subsequent matching and recognition tasks.

Inputs and Outputs

Inputs

Camera parameters: Camera intrinsics, distortion, color-camera, and passive-stereo parameters.

Outputs

Template Image: The generated single-channel grayscale template image.

Scaling Range: The scaling ratio range (minimum value to 1) calculated based on the input height range. This output value can serve as a reference for the scaling parameter in subsequent 2D template matching operators to adapt to dimensional changes caused by distance variations.

Parameters

Template Type

Description

Displayed based on the selected "Template Type": * Rectangle: * Length: The long-side dimension of the rectangle (mm). Default: 20. * Width: The short-side dimension of the rectangle (mm). Default: 30. * Parallelogram: * Length: The base length of the parallelogram (mm). Default: 20. * Height: The height of the parallelogram (mm). Default: 20. * Acute Angle: The acute angle between the parallelogram’s side and base (Unit: degree). Default: 30. * Isosceles Trapezoid: * Bottom Base: The bottom base length of the trapezoid (mm). Default: 40. * Top Base: The top base length of the trapezoid (mm). Default: 10. * Height: The height of the trapezoid (mm). Default: 20. * Circle: * Circle Radius: The radius of the circle (mm). Default: 10. * Concentric Circles: * Inner Diameter: The radius of the inner circle (mm). Default: 10. * Outer Diameter: The radius of the outer circle (mm). Default: 20. * Ellipse: * Major Axis: The major axis length of the ellipse (mm). Default: 100. * Minor Axis: The minor axis length of the ellipse (mm). Default: 30. * Text: * Text Size: The size of the text, affecting the pixel height of the generated text. Default: 30. * Text Content: The specific text string to generate. Default: "U"

Tuning Instructions

Configure the corresponding geometric dimension parameters based on the selected template type.

Parameter Range

Options: Rectangle, Parallelogram, Isosceles Trapezoid, Circle, Concentric Circles, Ellipse, Text, Default: Rectangle

Parameter Range

Values/Range:

  • Rectangle

  • Parallelogram

  • Isosceles Trapezoid

  • Circle

  • Concentric Circles

  • Ellipse

  • Text

Default: Rectangle

Height Range

Description

The possible height range of the target object from the camera. This range is used to calculate the pixel size of the object at different distances and affects the output "Scaling Range". The first value is the minimum distance, and the second value is the maximum distance.

Tuning Instructions

Estimate or measure the closest and farthest distances at which the target object may appear, based on the actual installation, and fill in these two values. An accurate height range helps generate a template with a more appropriate size and yields a useful scaling range parameter for subsequent matching.

Parameter Range

[0, 10000], Default: [1500, 3500], Unit: mm

Parameter Range

Values/Range: [0, 10000]

Default: [1500, 3500]

Unit: mm

Enable Fill

Description

Controls whether the generated shape is filled.

Tuning Instructions

Enable for a solid template; disable for an outline.

Parameter Range

Default: True

Image Padding Ratio

Description

Sets background padding on each side from the shape short side; total added padding is twice this ratio.

Tuning Instructions

Increase to add more background margin; decrease for a tighter image.

Parameter Range

[0.0, 1.0], Default: 0.2

Parameter Range

Values/Range: [0.0, 1.0]

Default: 0.2

Line Thickness

Description

Sets the line thickness used to draw an unfilled shape.

Tuning Instructions

Increase for a thicker outline; decrease for a finer outline.

Parameter Range

[1, 100], Default: 1

Parameter Range

Values/Range: [1, 100]

Default: 1

Circle Radius

Description

Sets the circle radius.

Tuning Instructions

Match it to the target circle size.

Parameter Range

[0, 10000], Default: 10

Parameter Range

Values/Range: [0, 10000]

Default: 10

Inner Diameter

Description

Sets the inner diameter of a concentric-circle template.

Tuning Instructions

Match it to the target opening.

Parameter Range

[0, 10000], Default: 10

Parameter Range

Values/Range: [0, 10000]

Default: 10

Outer Diameter

Description

Sets the outer diameter of a concentric-circle template.

Tuning Instructions

Match it to the target outer size and keep it larger than the inner diameter.

Parameter Range

[0, 10000], Default: 20

Parameter Range

Values/Range: [0, 10000]

Default: 20

Top Base

Description

Sets the upper-base length of an isosceles trapezoid.

Tuning Instructions

Match it to the target upper base.

Parameter Range

[0, 10000], Default: 10

Parameter Range

Values/Range: [0, 10000]

Default: 10

Bottom Base

Description

Sets the lower-base length of an isosceles trapezoid.

Tuning Instructions

Match it to the target lower base.

Parameter Range

[0, 10000], Default: 40

Parameter Range

Values/Range: [0, 10000]

Default: 40

Height

Description

Sets the height of the parallelogram or trapezoid.

Tuning Instructions

Match it to the target height.

Parameter Range

[0, 10000], Default: 20

Parameter Range

Values/Range: [0, 10000]

Default: 20

Length

Description

Sets the rectangle length or parallelogram base length.

Tuning Instructions

Match it to the target long dimension.

Parameter Range

[0, 10000], Default: 20

Parameter Range

Values/Range: [0, 10000]

Default: 20

Acute Angle

Description

Sets the acute angle between a parallelogram side and its base.

Tuning Instructions

Match it to the target side-to-base angle.

Parameter Range

[0, 10000], Default: 30, Unit: °

Parameter Range

Values/Range: [0, 10000]

Default: 30

Unit: °

Width

Description

Sets the rectangle width.

Tuning Instructions

Match it to the target short dimension.

Parameter Range

[0, 10000], Default: 30

Parameter Range

Values/Range: [0, 10000]

Default: 30

Text Size

Description

Sets the generated text size.

Tuning Instructions

Increase for larger text and decrease for smaller text.

Parameter Range

[0, 10000], Default: 30

Parameter Range

Values/Range: [0, 10000]

Default: 30

Text Content

Description

Sets the text rendered in the template.

Tuning Instructions

Enter the exact characters to match.

Parameter Range

Default: U

Major Axis

Description

Sets the ellipse long-axis size.

Tuning Instructions

Match it to the target major dimension.

Parameter Range

[0, 10000], Default: 100

Parameter Range

Values/Range: [0, 10000]

Default: 100

Minor Axis

Description

Sets the ellipse short-axis size.

Tuning Instructions

Match it to the target minor dimension.

Parameter Range

[0, 10000], Default: 30

Parameter Range

Values/Range: [0, 10000]

Default: 30

Image Source

Description

Selects the camera corresponding to the template size. In general, select the texture camera; if the input image is one of the first two images from passive stereo, select the depth camera.

Tuning Instructions

Use the texture camera for color or texture images, and the depth camera for depth images or passive-stereo main camera images.

Parameter Range

Options: Texture camera, depth camera, Default: Texture camera

Parameter Range

Values/Range:

  • Texture Camera

  • Depth Camera

Default: Texture Camera