Skip to content

symmetrySymmetrySymmetrysymmetrysymmetry🔗

Short description🔗

symmetrySymmetrySymmetrysymmetrysymmetry — Symmetry of gray values along a row.

Signature🔗

symmetry( image Image, out image ImageSymmetry, number MaskSize, number Direction, number Exponent )void Symmetry( const HObject& Image, HObject* ImageSymmetry, const HTuple& MaskSize, const HTuple& Direction, const HTuple& Exponent )static void HOperatorSet.Symmetry( HObject image, out HObject imageSymmetry, HTuple maskSize, HTuple direction, HTuple exponent )def symmetry( image: HObject, mask_size: int, direction: float, exponent: float ) -> HObject

Herror symmetry( const Hobject Image, Hobject* ImageSymmetry, const Hlong MaskSize, double Direction, double Exponent )

Herror T_symmetry( const Hobject Image, Hobject* ImageSymmetry, const Htuple MaskSize, const Htuple Direction, const Htuple Exponent )

HImage HImage::Symmetry( Hlong MaskSize, double Direction, double Exponent ) const

HImage HImage.Symmetry( int maskSize, double direction, double exponent )

Description🔗

symmetrySymmetry calculates the symmetry along a line. For each pixel the gray values of both sides of the line are compared: The absolute value of the differences of gray values with same distance to the pixel is computed. Each of these differences is weighted by the exponent (after division by 255) and then summed up.

\[\begin{eqnarray*} sym := 255 - \frac{255}{\textrm{MaskSize}} \sum_{i=1}^{\textrm{MaskSize}} {\left(\frac{|g(i) - g(-i)|}{255}\right)^{\textrm{Exponent}}} \end{eqnarray*}\]

Pixels with a high symmetry have large gray values.

Attention🔗

Currently only horizontal search lines are implemented. Note that the parameter Directiondirectiondirection exists for future extensions and can currently only have the value 0.0.

Note that filter operators may return unexpected results if an image with a reduced domain is used as input. Please refer to the chapter Filters.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Automatically parallelized on tuple level.

  • Automatically parallelized on channel level.

  • Automatically parallelized on domain level.

Parameters🔗

Imageimageimage (input_object) (multichannel-)image(-array) → object (byte)HObject (byte)HImage (byte)HObject (byte)Hobject (byte)

Input image.

ImageSymmetryimageSymmetryimage_symmetry (output_object) (multichannel-)image(-array) → object (byte)HObject (byte)HImage (byte)HObject (byte)Hobject * (byte)

Symmetry image.

MaskSizemaskSizemask_size (input_control) number → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Extension of search area.

Default: 4040
Suggested values: 3, 5, 7, 10, 15, 20, 25, 30, 40, 50, 60, 70, 80, 100, 120, 140, 1803, 5, 7, 10, 15, 20, 25, 30, 40, 50, 60, 70, 80, 100, 120, 140, 180
Value range: 3 ≤ MaskSize ≤ 1000
Minimum increment: 1
Recommended increment: 2

Directiondirectiondirection (input_control) number → (real)HTuple (double)HTuple (double)floatHtuple (double)

Angle of test direction.

Default: 0.00.0
Suggested values: 0.00.0
Value range: 0.0 ≤ Direction ≤ 0.0

Exponentexponentexponent (input_control) number → (real)HTuple (double)HTuple (double)floatHtuple (double)

Exponent for weighting.

Default: 0.50.5
Suggested values: 0.1, 0.2, 0.3, 0.4, 0.5, 0.7, 0.8, 0.9, 1.00.1, 0.2, 0.3, 0.4, 0.5, 0.7, 0.8, 0.9, 1.0
Minimum increment: 0.01
Recommended increment: 0.1
Restriction: 0 < Exponent && Exponent <= 100

Example🔗

(HDevelop)


read_image(Image,'monkey')
symmetry(Image,ImageSymmetry,70,0.0,0.5)
threshold(ImageSymmetry,SymmPoints,170,255)

Result🔗

If the parameter values are correct the operator symmetrySymmetry returns the value 2 (H_MSG_TRUE) The behavior in case of empty input (no input images available) is set via the operator set_system(::'no_object_result',<Result>:). If necessary an exception is raised.

Combinations with other operators🔗

Combinations

Possible successors

thresholdThreshold

Module🔗

Foundation