HALCON Reference Manual 10.0.2
Table of Contents / Regions / Features ClassesClassesClasses | | | Operators

contlengthcontlengthcontlengthContlengthContlength (Operator)

Name

contlengthcontlengthcontlengthContlengthContlength — Contour length of a region.

Signature

contlength(Regions : : : ContLength)

Herror contlength(const Hobject Regions, double* ContLength)

Herror T_contlength(const Hobject Regions, Htuple* ContLength)

Herror contlength(Hobject Regions, double* ContLength)

Herror contlength(Hobject Regions, HTuple* ContLength)

double HRegion::Contlength() const

HTuple HRegionArray::Contlength() const

void HOperatorSetX.Contlength(
[in] IHUntypedObjectX* Regions, [out] VARIANT* ContLength)

VARIANT HRegionX.Contlength()

static void HOperatorSet.Contlength(HObject regions, out HTuple contLength)

HTuple HRegion.Contlength()

Description

The operator contlengthcontlengthcontlengthContlengthContlength calculates the total length of the contour (sum of all connection components of the region) for each region of RegionsRegionsRegionsRegionsregions. The distance between two neighboring contour points parallel to the coordinate axes is rated 1, the distance in the diagonal is rated sqrt(2). If more than one region is passed the numerical values of the contour length are stored in a tuple, the position of a value in the tuple corresponding to the position of the region in the input tuple. In case of an empty region the operator contlengthcontlengthcontlengthContlengthContlength returns the value 0.

Attention

The contour of holes is not calculated.

Parallelization

Parameters

RegionsRegionsRegionsRegionsregions (input_object)  region(-array) objectHRegionHRegionHRegionXHobject

Region(s) to be examined.

ContLengthContLengthContLengthContLengthcontLength (output_control)  real(-array) HTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double)

Contour length of the input region(s).

Assertion: ContLength >= 0

Example (C++)

#include "HIOStream.h"
#if !defined(USE_IOSTREAM_H)
using namespace std;
#endif
#include "HalconCpp.h"
using namespace Halcon;

int main (int argc, char *argv[])
{
  if (argc < 2)
  {
    cout << "Usage: " << argv[0] << " <# of regions> " << endl;
    return (-1);
  }

  HWindow        w;
  HRegionArray   reg;

  int NumOfElements = atoi (argv[1]);

  cout << "Draw " << NumOfElements << " regions " << endl;

  for (int i=0; i < NumOfElements; i++)
  {
    reg[i] = w.DrawRegion ();
  }

  Tuple circ = reg.Circularity ();
  Tuple cont = reg.Contlength ();

  for (i = 0; i < NumOfElements; i++)
  {
    cout << "Circularity of " << i+1 << ". region = " << circ[i].D();
    cout << "\t\t Contour Length of" << i+1 <<
            ". region = " << cont[i].D() << endl;
  }

  w.Click ();
  return(0);
}

Result

The operator contlengthcontlengthcontlengthContlengthContlength returns the value 2 (H_MSG_TRUE) if the input is not empty. The behavior in case of empty input (no input regions available) is set via the operator set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>). If necessary an exception is raised.

Possible Predecessors

thresholdthresholdthresholdThresholdThreshold, regiongrowingregiongrowingregiongrowingRegiongrowingRegiongrowing, connectionconnectionconnectionConnectionConnection

Possible Successors

get_region_contourget_region_contourget_region_contourGetRegionContourGetRegionContour

Alternatives

compactnesscompactnesscompactnessCompactnessCompactness

See also

area_centerarea_centerarea_centerAreaCenterAreaCenter, get_region_contourget_region_contourget_region_contourGetRegionContourGetRegionContour

Module

Foundation


Table of Contents / Regions / Features ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH