complementcomplementComplementComplementcomplement (算子)
名称
complementcomplementComplementComplementcomplement — 返回一个区域的补集。
签名
def complement(region: HObject) -> HObject
描述
complementcomplementComplementComplementComplementcomplement determines the complement of the input
region(s).
If the system flag 'clip_region'"clip_region""clip_region""clip_region""clip_region""clip_region" is 'true'"true""true""true""true""true", which
is the default, the difference of the largest image processed so far
(see reset_obj_dbreset_obj_dbResetObjDbResetObjDbResetObjDbreset_obj_db) and the input region is returned.
If the system flag 'clip_region'"clip_region""clip_region""clip_region""clip_region""clip_region" is 'false'"false""false""false""false""false" (see
set_systemset_systemSetSystemSetSystemSetSystemset_system), the resulting region would be infinitely large.
To avoid this, the complement is done only virtually by setting
the complement flag of RegionRegionRegionRegionregionregion to TRUE. For succeeding
operations the de Morgan laws are applied while calculating results. Using
complementcomplementComplementComplementComplementcomplement with 'clip_region'"clip_region""clip_region""clip_region""clip_region""clip_region" set to 'false'"false""false""false""false""false" makes
sense only to avoid fringe effects, e.g., if the area of
interest is bigger or smaller than the image. For the latter case, the
clipping would be set explicitly. If there is no reason to use the
operator with 'clip_region'"clip_region""clip_region""clip_region""clip_region""clip_region"='false'"false""false""false""false""false" but you need the flag
for other operations of your program, it is recommended to temporarily set
the system flag to'true'"true""true""true""true""true" and change it back to 'false'"false""false""false""false""false"
after applying complementcomplementComplementComplementComplementcomplement. Otherwise, negative regions may result
from succeeding operations.
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 在元组级别上自动并行化。
参数
RegionRegionRegionRegionregionregion (输入对象) region(-array) → objectHRegionHObjectHRegionHobject
Input region(s).
RegionComplementRegionComplementRegionComplementRegionComplementregionComplementregion_complement (输出对象) region(-array) → objectHRegionHObjectHRegionHobject *
Complemented regions.
元素数量:
RegionComplement == Region
结果
complementcomplementComplementComplementComplementcomplement 始终返回值 2 ( H_MSG_TRUE )。当输入为空(未指定区域)时则可设置行为通过 set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>) 以及输入区域为空时可设置行为通过 set_system('empty_region_result',<Result>)set_system("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)set_system("empty_region_result",<Result>)。如有必要,则抛出异常。
可能的前趋
thresholdthresholdThresholdThresholdThresholdthreshold,
connectionconnectionConnectionConnectionConnectionconnection,
regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing,
pouringpouringPouringPouringPouringpouring,
class_ndim_normclass_ndim_normClassNdimNormClassNdimNormClassNdimNormclass_ndim_norm
可能的后继
select_shapeselect_shapeSelectShapeSelectShapeSelectShapeselect_shape
另见
differencedifferenceDifferenceDifferenceDifferencedifference,
union1union1Union1Union1Union1union1,
union2union2Union2Union2Union2union2,
intersectionintersectionIntersectionIntersectionIntersectionintersection,
reset_obj_dbreset_obj_dbResetObjDbResetObjDbResetObjDbreset_obj_db,
set_systemset_systemSetSystemSetSystemSetSystemset_system
模块
基础