copy_objcopy_objCopyObjCopyObjcopy_obj (Operator)

Name

copy_objcopy_objCopyObjCopyObjcopy_obj — Copy an iconic object in the HALCON database.

Signature

copy_obj(Objects : ObjectsSelected : Index, NumObj : )

Herror copy_obj(const Hobject Objects, Hobject* ObjectsSelected, const Hlong Index, const Hlong NumObj)

Herror T_copy_obj(const Hobject Objects, Hobject* ObjectsSelected, const Htuple Index, const Htuple NumObj)

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)

def copy_obj(objects: HObject, index: int, num_obj: int) -> HObject

Description

copy_objcopy_objCopyObjCopyObjCopyObjcopy_obj copies NumObjNumObjNumObjNumObjnumObjnum_obj iconic objects beginning with index IndexIndexIndexIndexindexindex (starting with 1) from the iconic input object tuple ObjectsObjectsObjectsObjectsobjectsobjects to the output object ObjectsSelectedObjectsSelectedObjectsSelectedObjectsSelectedobjectsSelectedobjects_selected. If -1 is passed for NumObjNumObjNumObjNumObjnumObjnum_obj all objects beginning with IndexIndexIndexIndexindexindex are copied. No new storage is allocated for the regions and images. Instead, new objects containing references to the existing objects are created. The number of objects in an object tuple can be queried with the operator count_objcount_objCountObjCountObjCountObjcount_obj.

For a short description of the iconic objects that are available in HALCON see the introduction of chapter Object.

Execution Information

Parameters

ObjectsObjectsObjectsObjectsobjectsobjects (input_object)  object(-array) objectHObjectHObjectHObjectHobject

Objects to be copied.

ObjectsSelectedObjectsSelectedObjectsSelectedObjectsSelectedobjectsSelectedobjects_selected (output_object)  object(-array) objectHObjectHObjectHObjectHobject *

Copied objects.

IndexIndexIndexIndexindexindex (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Starting index of the objects to be copied.

Default value: 1

Suggested values: 1, 2, 3, 4, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000

Typical range of values: 1 ≤ Index Index Index Index index index

Restriction: Index <= number(Objects)

NumObjNumObjNumObjNumObjnumObjnum_obj (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of objects to be copied or -1.

Default value: 1

Suggested values: -1, 1, 2, 3, 4, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000

Typical range of values: -1 ≤ NumObj NumObj NumObj NumObj numObj num_obj

Restriction: NumObj + Index - 1 <= number(Objects) && NumObj != 0

Example (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)

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

Example (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)

Example (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)

Example (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)

Complexity

Runtime complexity: O(|ObjectsObjectsObjectsObjectsobjectsobjects| + NumObjNumObjNumObjNumObjnumObjnum_obj);

Memory complexity of the result object: O(NumObjNumObjNumObjNumObjnumObjnum_obj)

Result

copy_objcopy_objCopyObjCopyObjCopyObjcopy_obj returns 2 (H_MSG_TRUE) if all objects are contained in the HALCON database and all parameters are correct. If the input is empty the behavior can be set via 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>). If necessary, an exception is raised.

Possible Predecessors

count_objcount_objCountObjCountObjCountObjcount_obj

Alternatives

select_objselect_objSelectObjSelectObjSelectObjselect_obj

See also

count_objcount_objCountObjCountObjCountObjcount_obj, concat_objconcat_objConcatObjConcatObjConcatObjconcat_obj, obj_to_integerobj_to_integerObjToIntegerObjToIntegerObjToIntegerobj_to_integer, copy_imagecopy_imageCopyImageCopyImageCopyImagecopy_image

Module

Foundation