copy_objcopy_objCopyObjCopyObjcopy_obj复制对象(算子)
名称
copy_objcopy_objCopyObjCopyObjcopy_obj — 复制 HALCON 数据库中的图标对象。
签名
void CopyObj(const HObject& Objects, HObject* ObjectsSelected, const HTuple& Index, const HTuple& NumObj)
HObject HObject::CopyObj(Hlong Index, Hlong NumObj) const
HImage HImage::CopyObj(Hlong Index, Hlong NumObj) const
HRegion HRegion::CopyObj(Hlong Index, Hlong NumObj) const
HXLD HXLD::CopyObj(Hlong Index, Hlong NumObj) const
HXLDCont HXLDCont::CopyObj(Hlong Index, Hlong NumObj) const
HXLDPoly HXLDPoly::CopyObj(Hlong Index, Hlong NumObj) const
HXLDPara HXLDPara::CopyObj(Hlong Index, Hlong NumObj) const
HXLDModPara HXLDModPara::CopyObj(Hlong Index, Hlong NumObj) const
HXLDExtPara HXLDExtPara::CopyObj(Hlong Index, Hlong NumObj) const
static void HOperatorSet.CopyObj(HObject objects, out HObject objectsSelected, HTuple index, HTuple numObj)
HObject HObject.CopyObj(int index, int numObj)
HImage HImage.CopyObj(int index, int numObj)
HRegion HRegion.CopyObj(int index, int numObj)
HXLD HXLD.CopyObj(int index, int numObj)
HXLDCont HXLDCont.CopyObj(int index, int numObj)
HXLDPoly HXLDPoly.CopyObj(int index, int numObj)
HXLDPara HXLDPara.CopyObj(int index, int numObj)
HXLDModPara HXLDModPara.CopyObj(int index, int numObj)
HXLDExtPara HXLDExtPara.CopyObj(int index, int numObj)
描述
copy_objcopy_objCopyObjCopyObjCopyObjcopy_obj 将图标输入对象元组 ObjectsObjectsObjectsObjectsobjectsobjects 中从索引IndexIndexIndexIndexindexindex(从 1 开始)起始的 NumObjNumObjNumObjNumObjnumObjnum_obj 个图标对象复制到输出对象 ObjectsSelectedObjectsSelectedObjectsSelectedObjectsSelectedobjectsSelectedobjects_selected。若 NumObjNumObjNumObjNumObjnumObjnum_obj
传入 -1,则复制索引 IndexIndexIndexIndexindexindex 起始的所有对象。区域和图像不会分配新存储空间,而是创建包含现有对象引用的新对象。对象元组中的对象数量可通过 count_objcount_objCountObjCountObjCountObjcount_obj 算子查询。
有关 HALCON 中可用图标对象的简要说明,请参阅 对象 一章的引言部分。
执行信息
- 支持计算设备上的对象。
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
参数
ObjectsObjectsObjectsObjectsobjectsobjects (输入对象) object(-array) → objectHObjectHObjectHObjectHobject
待复制的对象。
ObjectsSelectedObjectsSelectedObjectsSelectedObjectsSelectedobjectsSelectedobjects_selected (输出对象) object(-array) → objectHObjectHObjectHObjectHobject *
复制的对象。
IndexIndexIndexIndexindexindex (输入控制) integer → HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
待复制对象的起始索引。
默认值:
1
建议值:
1, 2, 3, 4, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000
值范围:
1
≤
Index
Index
Index
Index
index
index
限制:
Index <= number(Objects)
NumObjNumObjNumObjNumObjnumObjnum_obj (输入控制) integer → HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)
要复制的对象数量或 -1。
默认值:
1
建议值:
-1, 1, 2, 3, 4, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000
值范围:
-1
≤
NumObj
NumObj
NumObj
NumObj
numObj
num_obj
限制:
NumObj + Index - 1 <= number(Objects) && NumObj != 0
示例(HDevelop)
gen_circle (Circles, [100,200,400], [200,100,400], [100,100,50])
copy_obj (Circles, CircleCopy, 2, 3)
erosion_circle (CircleCopy, CircleErosion, 15.5)
dev_set_color ('red')
dev_set_draw ('fill')
dev_display(Circles)
dev_set_color ('white')
dev_set_draw ('margin')
dev_display (CircleCopy)
dev_set_color ('green')
dev_display (CircleErosion)
示例(C)
/* Access all regions */
count_obj(Regions,&Num);
for (i=1; i<=Num; i++);
{
copy_obj(Regions,&Single,i,1);
T_get_region_polygon(Single,5.0,&Row,&Column);
T_disp_polygon(WindowHandleTuple,Row,Column);
destroy_tuple(Row);
destroy_tuple(Column);
}
示例(HDevelop)
gen_circle (Circles, [100,200,400], [200,100,400], [100,100,50])
copy_obj (Circles, CircleCopy, 2, 3)
erosion_circle (CircleCopy, CircleErosion, 15.5)
dev_set_color ('red')
dev_set_draw ('fill')
dev_display(Circles)
dev_set_color ('white')
dev_set_draw ('margin')
dev_display (CircleCopy)
dev_set_color ('green')
dev_display (CircleErosion)
示例(HDevelop)
gen_circle (Circles, [100,200,400], [200,100,400], [100,100,50])
copy_obj (Circles, CircleCopy, 2, 3)
erosion_circle (CircleCopy, CircleErosion, 15.5)
dev_set_color ('red')
dev_set_draw ('fill')
dev_display(Circles)
dev_set_color ('white')
dev_set_draw ('margin')
dev_display (CircleCopy)
dev_set_color ('green')
dev_display (CircleErosion)
示例(HDevelop)
gen_circle (Circles, [100,200,400], [200,100,400], [100,100,50])
copy_obj (Circles, CircleCopy, 2, 3)
erosion_circle (CircleCopy, CircleErosion, 15.5)
dev_set_color ('red')
dev_set_draw ('fill')
dev_display(Circles)
dev_set_color ('white')
dev_set_draw ('margin')
dev_display (CircleCopy)
dev_set_color ('green')
dev_display (CircleErosion)
复杂度
运行时间复杂度:
O(|ObjectsObjectsObjectsObjectsobjectsobjects| + NumObjNumObjNumObjNumObjnumObjnum_obj);
结果对象的内存复杂度: O(NumObjNumObjNumObjNumObjnumObjnum_obj)
结果
copy_objcopy_objCopyObjCopyObjCopyObjcopy_obj 算子返回 2 (H_MSG_TRUE),当所有对象均存在于 HALCON 数据库中且所有参数均正确。当输入为空时,可设置行为通过算子 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>)。如有必要,则抛出异常。
可能的前趋
count_objcount_objCountObjCountObjCountObjcount_obj
替代
select_objselect_objSelectObjSelectObjSelectObjselect_obj
另见
count_objcount_objCountObjCountObjCountObjcount_obj,
concat_objconcat_objConcatObjConcatObjConcatObjconcat_obj,
obj_to_integerobj_to_integerObjToIntegerObjToIntegerObjToIntegerobj_to_integer,
copy_imagecopy_imageCopyImageCopyImageCopyImagecopy_image
模块
基础