Skip to content

select_region_pointSelectRegionPointSelectRegionPointselect_region_pointselect_region_point🔗

Short description🔗

select_region_pointSelectRegionPointSelectRegionPointselect_region_pointselect_region_point — Choose all regions containing a given pixel.

Signature🔗

select_region_point( region Regions, out region DestRegions, point.y Row, point.x Column )void SelectRegionPoint( const HObject& Regions, HObject* DestRegions, const HTuple& Row, const HTuple& Column )static void HOperatorSet.SelectRegionPoint( HObject regions, out HObject destRegions, HTuple row, HTuple column )def select_region_point( regions: HObject, row: int, column: int ) -> HObject

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 )

HRegion HRegion::SelectRegionPoint( Hlong Row, Hlong Column ) const

HRegion HRegion.SelectRegionPoint( int row, int column )

Description🔗

The operator select_region_pointSelectRegionPoint selects all regions from Regionsregionsregions containing the test pixel (Rowrowrow,Columncolumncolumn), i.e.:

\[\begin{eqnarray*} |\textrm{Regions}[n] \cap \{(\textrm{Row},\textrm{Column})\}| = 1 \end{eqnarray*}\]

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.

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.

Parameters🔗

Regionsregionsregions (input_object) region-array → objectHObjectHRegionHObjectHobject

Regions to be examined.

DestRegionsdestRegionsdest_regions (output_object) region-array → objectHObjectHRegionHObjectHobject *

All regions containing the test pixel.

Rowrowrow (input_control) point.y → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Line index of the test pixel.

Default: 100100

Columncolumncolumn (input_control) point.x → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

Column index of the test pixel.

Default: 100100

Example🔗

(HDevelop)

read_image(Image,'fabrik')
regiongrowing(Image,Seg,3,3,5,0)
dev_set_color('red')
dev_set_draw('margin')
Button := 1
while (Button == 1)
  get_mbutton(WindowHandle,Row,Column,Button)
  select_region_point(Seg,Single,Row,Column)
  dev_display(Image)
  dev_display(Single)
endwhile
(C)
read_image(&Image,"fabrik")\;
regiongrowing(Image,&Seg,3,3,5.0,0)\;
do {
  printf("Select the region with the mouse (End right button \n")\;
  get_mbutton(WindowHandle,&Row,&Column,&Button)\;
  select_region_point(Seg,&Single,Row,Column)\;
  clear(Single)\;
} while(Button != 4)\;
(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\;
 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] = " << (Hlong) rc.X() << ", " << (long) rc.Y() << endl\;
    ireg = reg.SelectRegionPoint ((Hlong) rc.Y(), (long) rc.X())\;
    img.Display (w)\;
    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(\sqrt{F}) * N)\).

Result🔗

The operator select_region_pointSelectRegionPoint 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>). If necessary an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

thresholdThreshold, regiongrowingRegiongrowing, connectionConnection

Alternatives

test_region_pointTestRegionPoint

See also

get_mbuttonGetMbutton, get_mpositionGetMposition

Module🔗

Foundation