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

select_region_pointselect_region_pointselect_region_pointSelectRegionPointSelectRegionPoint (Operator)

Name

select_region_pointselect_region_pointselect_region_pointSelectRegionPointSelectRegionPoint — Choose all regions containing a given pixel.

Signature

select_region_point(Regions : DestRegions : Row, Column : )

Herror select_region_point(const Hobject Regions, Hobject* DestRegions, const Hlong Row, const Hlong Column)

Herror T_select_region_point(const Hobject Regions, Hobject* DestRegions, const Htuple Row, const Htuple Column)

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

HRegionArray HRegionArray::SelectRegionPoint(const HTuple& Row, const HTuple& Column) const

void HOperatorSetX.SelectRegionPoint(
[in] IHUntypedObjectX* Regions, [out] IHUntypedObjectX*DestRegions, [in] VARIANT Row, [in] VARIANT Column)

IHRegionX* HRegionX.SelectRegionPoint(
[in] Hlong Row, [in] Hlong Column)

static void HOperatorSet.SelectRegionPoint(HObject regions, out HObject destRegions, HTuple row, HTuple column)

HRegion HRegion.SelectRegionPoint(int row, int column)

Description

The operator select_region_pointselect_region_pointselect_region_pointSelectRegionPointSelectRegionPoint selects all regions from RegionsRegionsRegionsRegionsregions containing the test pixel (RowRowRowRowrow,ColumnColumnColumnColumncolumn), 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.

Parallelization

Parameters

RegionsRegionsRegionsRegionsregions (input_object)  region-array objectHRegionHRegionArrayHRegionXHobject

Regions to be examined.

DestRegionsDestRegionsDestRegionsDestRegionsdestRegions (output_object)  region-array objectHRegionHRegionArrayHRegionXHobject *

All regions containing the test pixel.

RowRowRowRowrow (input_control)  point.y HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Line index of the test pixel.

Default value: 100

ColumnColumnColumnColumncolumn (input_control)  point.x HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Column index of the test pixel.

Default value: 100

Example (HDevelop)

read_image(Image,'fabrik')
open_window(0,0,-1,-1,'root','visible','',WindowHandle)
disp_image(Image,WindowHandle)
regiongrowing(Image,Seg,3,3,5,0)
set_color(WindowHandle,'red')
set_draw(WindowHandle,'margin')
Button := 1
while (Button = 1)
  fwrite_string(FileId,'Select the region with the mouse (End right button)')
  fnew_line(FileId)
  get_mbutton(WindowHandle,Row,Column,Button)
  select_region_point(Seg,Single,Row,Column)
  disp_region(Single,WindowHandle)
endwhile

Example (C)

read_image(&Image,"fabrik");
open_window(0,0,-1,-1,0,"visible","",&WindowHandle);
disp_image(Image);
regiongrowing(Image,&Seg,3,3,5.0,0);
set_color(WindowHandle,"red");
set_draw(WindowHandle,"margin");
do {
  printf("Select the region with the mouse (End right buttonn \n");
  get_mbutton(WindowHandle,&Row,&Column,&Button);
  select_region_point(Seg,&Single,Row,Column);
  disp_region(Single,WindowHandle);
  clear(Single);
} while(Button != 4);

Example (C++)

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

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);
}

Example (HDevelop)

read_image(Image,'fabrik')
open_window(0,0,-1,-1,'root','visible','',WindowHandle)
disp_image(Image,WindowHandle)
regiongrowing(Image,Seg,3,3,5,0)
set_color(WindowHandle,'red')
set_draw(WindowHandle,'margin')
Button := 1
while (Button = 1)
  fwrite_string(FileId,'Select the region with the mouse (End right button)')
  fnew_line(FileId)
  get_mbutton(WindowHandle,Row,Column,Button)
  select_region_point(Seg,Single,Row,Column)
  disp_region(Single,WindowHandle)
endwhile

Example (HDevelop)

read_image(Image,'fabrik')
open_window(0,0,-1,-1,'root','visible','',WindowHandle)
disp_image(Image,WindowHandle)
regiongrowing(Image,Seg,3,3,5,0)
set_color(WindowHandle,'red')
set_draw(WindowHandle,'margin')
Button := 1
while (Button = 1)
  fwrite_string(FileId,'Select the region with the mouse (End right button)')
  fnew_line(FileId)
  get_mbutton(WindowHandle,Row,Column,Button)
  select_region_point(Seg,Single,Row,Column)
  disp_region(Single,WindowHandle)
endwhile

Complexity

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

Result

The operator select_region_pointselect_region_pointselect_region_pointSelectRegionPointSelectRegionPoint returns the value 2 (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>)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

Alternatives

test_region_pointtest_region_pointtest_region_pointTestRegionPointTestRegionPoint

See also

get_mbuttonget_mbuttonget_mbuttonGetMbuttonGetMbutton, get_mpositionget_mpositionget_mpositionGetMpositionGetMposition

Module

Foundation


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