Herror ::difference (
    Hobject Region,
    Hobject Sub,
    Hobject *RegionDifference
)
HRegion HRegion::Difference (
    const HRegionArray &Sub
) const
HRegionArray HRegionArray::Difference (
    const HRegionArray &Sub
) const

Calculate the difference of two regions.

::difference calculates the set-theoretic difference of two regions:

   (Regions in Region) - (Regions in Sub)
The resulting region is defined as the input region (Region) with all points from Sub removed. The following two special regions can also be used as input:
     'full'    i.e., the full region (FULL_REGION in Halcon/C) or
     'empty'   i.e., the empty region (EMPTY_REGION in Halcon/C).


Attention

Empty regions are valid for both parameters. On output, empty regions may result The value of the system flag 'store_empty_region' determines the behavior in this case.


Parameters

Region (input_object)
region(-array) -> Hobject: HRegion(Array)
Regions to be processed.

Sub (input_object)
region(-array) -> Hobject: HRegion(Array)
The union of these regions is subtracted from Region.

RegionDifference (output_object)
region(-array) -> Hobject * : HRegion(Array)
Resulting region.


Example
/* provides the region X without the points in Y */
difference(X,Y,&RegionDifference);
/* provides the region. */
difference(Region,EMPTY_REGION,&RegionDifference);

Complexity

Let N be the number of regions, F_{1} be their average area, and F_{2} be the total area of all regions in Sub. Then the runtime complexity is O(F_{1} * F_{1}) + N * (F_{1} + F_{2})).


Result

::difference always returns the value H_MSG_TRUE. The behavior in case of empty input (no regions given) can be set via ::set_system('no_object_result',<Result>) and the behavior in case of an empty input region via ::set_system('empty_region_result',<Result>). If necessary, an exception handling is raised.


Possible Predecessors

::threshold, ::connection, ::regiongrowing, ::pouring, ::class_ndim_norm


Possible Successors

::select_shape, ::disp_region


See also

::intersection, ::union1, ::union2, ::complement


Module

Region processing



Copyright © 1996-2002 MVTec Software GmbH