Herror ::select_region_point (
    Hobject Regions,
    Hobject *DestRegions,
    const HTuple &Row,
    const HTuple &Column
)
HRegionArray HRegionArray::SelectRegionPoint (
    const HTuple &Row,
    const HTuple &Column
) const

Choose all regions containing a given pixel.

The operator ::select_region_point selects alle regions from Regions containing the test pixel (Row,Column), i.e.:

            |Region[n] intersection {(Row,Column)}| = 1


Attention

If the regions overlap more than one region might contain the pixel. In this case all these regions are returned. If no region contains the indicated pixel the empty tuple (= no region) is returned.


Parameters

Regions (input_object)
region-array -> Hobject: HRegionArray
Regions to be examined.

DestRegions (output_object)
region-array -> Hobject * : HRegionArray
All regions containing the test pixel.

Row (input_control)
point.y -> HTuple.long
Line index of the test pixel.
Default value: 100
Typical range of values: -oo <= Row <= -oo (lin)

Column (input_control)
point.x -> HTuple.long
Column index of the test pixel.
Default value: 100
Typical range of values: -oo <= Column <= -oo (lin)


Example
#include  <iostream.h>
#include  "HalconCpp.h"

int main ()
{
  HImage        img ("fabrik");
  HWindow       w;
  HRegionArray  ireg, reg;
  DPoint2D      rc;
  int           Button;

  img.Display (w);
  reg = img.Regiongrowing (3, 3, 5, 100);
  reg.Display (w);
  w.SetColor ("red");
  w.SetDraw  ("margin");

  cout << "Select any region with left mouse button (right button ends)"
       << endl;
  do
  {
    rc = w.GetMbutton (&Button);
    cout << "[x, y] = " << (long) rc.X() << ", " << (long) rc.Y() << endl;
    ireg = reg.SelectRegionPoint ((long) rc.Y(), (long) rc.X());
    ireg.Display (w);
  } while (Button != 4);
  return(0);
}

Complexity

If F is the area of the region and N is the number of regions, the mean runtime complexity is O(ln(F) * N).


Result

The operator ::select_region_point returns the value H_MSG_TRUE if the parameters are correct. The behavior in case of empty input (no input regions available) is set via the operator ::set_system('no_object_result',<Result>). If necessary an exception handling is raised.


Possible Predecessors

::threshold, ::regiongrowing, ::connection


Alternatives

::test_region_point


See also

::get_mbutton, ::get_mposition


Module

Region processing



Copyright © 1996-2002 MVTec Software GmbH