compare_objcompare_objCompareObjCompareObj (Operator)


compare_objcompare_objCompareObjCompareObj — Compare iconic objects regarding equality.


compare_obj(Objects1, Objects2 : : Epsilon : IsEqual)

Herror compare_obj(const Hobject Objects1, const Hobject Objects2, double Epsilon, Hlong* IsEqual)

Herror T_compare_obj(const Hobject Objects1, const Hobject Objects2, const Htuple Epsilon, Htuple* IsEqual)

void CompareObj(const HObject& Objects1, const HObject& Objects2, const HTuple& Epsilon, HTuple* IsEqual)

Hlong HObject::CompareObj(const HObject& Objects2, const HTuple& Epsilon) const

Hlong HObject::CompareObj(const HObject& Objects2, double Epsilon) const

Hlong HImage::CompareObj(const HImage& Objects2, const HTuple& Epsilon) const

Hlong HImage::CompareObj(const HImage& Objects2, double Epsilon) const

Hlong HRegion::CompareObj(const HRegion& Objects2, const HTuple& Epsilon) const

Hlong HRegion::CompareObj(const HRegion& Objects2, double Epsilon) const

Hlong HXLD::CompareObj(const HXLD& Objects2, const HTuple& Epsilon) const

Hlong HXLD::CompareObj(const HXLD& Objects2, double Epsilon) const

Hlong HXLDCont::CompareObj(const HXLDCont& Objects2, const HTuple& Epsilon) const

Hlong HXLDCont::CompareObj(const HXLDCont& Objects2, double Epsilon) const

Hlong HXLDPoly::CompareObj(const HXLDPoly& Objects2, const HTuple& Epsilon) const

Hlong HXLDPoly::CompareObj(const HXLDPoly& Objects2, double Epsilon) const

Hlong HXLDPara::CompareObj(const HXLDPara& Objects2, const HTuple& Epsilon) const

Hlong HXLDPara::CompareObj(const HXLDPara& Objects2, double Epsilon) const

Hlong HXLDModPara::CompareObj(const HXLDModPara& Objects2, const HTuple& Epsilon) const

Hlong HXLDModPara::CompareObj(const HXLDModPara& Objects2, double Epsilon) const

Hlong HXLDExtPara::CompareObj(const HXLDExtPara& Objects2, const HTuple& Epsilon) const

Hlong HXLDExtPara::CompareObj(const HXLDExtPara& Objects2, double Epsilon) const

static void HOperatorSet.CompareObj(HObject objects1, HObject objects2, HTuple epsilon, out HTuple isEqual)

int HObject.CompareObj(HObject objects2, HTuple epsilon)

int HObject.CompareObj(HObject objects2, double epsilon)

int HImage.CompareObj(HImage objects2, HTuple epsilon)

int HImage.CompareObj(HImage objects2, double epsilon)

int HRegion.CompareObj(HRegion objects2, HTuple epsilon)

int HRegion.CompareObj(HRegion objects2, double epsilon)

int HXLD.CompareObj(HXLD objects2, HTuple epsilon)

int HXLD.CompareObj(HXLD objects2, double epsilon)

int HXLDCont.CompareObj(HXLDCont objects2, HTuple epsilon)

int HXLDCont.CompareObj(HXLDCont objects2, double epsilon)

int HXLDPoly.CompareObj(HXLDPoly objects2, HTuple epsilon)

int HXLDPoly.CompareObj(HXLDPoly objects2, double epsilon)

int HXLDPara.CompareObj(HXLDPara objects2, HTuple epsilon)

int HXLDPara.CompareObj(HXLDPara objects2, double epsilon)

int HXLDModPara.CompareObj(HXLDModPara objects2, HTuple epsilon)

int HXLDModPara.CompareObj(HXLDModPara objects2, double epsilon)

int HXLDExtPara.CompareObj(HXLDExtPara objects2, HTuple epsilon)

int HXLDExtPara.CompareObj(HXLDExtPara objects2, double epsilon)


The operator compare_objcompare_objCompareObjCompareObjCompareObj compares iconic objects regarding equality. The iconic objects are passed in the two input parameters Objects1Objects1Objects1Objects1objects1 and Objects2Objects2Objects2Objects2objects2 in form of (possibly mixed) tuples of images, regions, or XLDs. The n-th object in Objects1Objects1Objects1Objects1objects1 is compared to the n-th object in Objects2Objects2Objects2Objects2objects2 (for all n). If the two passed object tuples have the same length and if all objects are equal, the parameter IsEqualIsEqualIsEqualIsEqualisEqual is set to 1, otherwise to 0.

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

Depending on the type of the input objects, different conditions must be met for the equality of two objects. In the following, the conditions for each possible iconic object are listed:


For all channels, the gray values of the respective pixels must not differ by more than EpsilonEpsilonEpsilonEpsilonepsilon. Note that images are only compared within their domain (ROI) and they are only equal if they have the same domain (ROI).


The regions must be equal. The parameter EpsilonEpsilonEpsilonEpsilonepsilon has no effect for the comparison of regions.

XLD contours:

XLD contours must have the same number of points and attributes. The point coordinates and the attribute values must not differ by more than EpsilonEpsilonEpsilonEpsilonepsilon.

XLD polygons:

XLD polygons must have the same number of line segments. The length and the orientation of these segments as well as the coordinates of the control points must not differ by more than EpsilonEpsilonEpsilonEpsilonepsilon.

XLD parallels and extended XLD parallels:

XLD parallels must have an identical index of the start and end line segment of the parallels of the first polygon (P1) and the second polygon (P2) as well as identical pointers to the underlying contours.

Modified XLD parallels:

For modified XLD parallels, the same conditions apply as for XLD parallels and extended XLD parallels. Furthermore, the distances between the line segments of the parallel polygons must be identical.

Note that compare_objcompare_objCompareObjCompareObjCompareObj compares all objects regarding their actual content. In contrast test_equal_objtest_equal_objTestEqualObjTestEqualObjTestEqualObj compares only regions regarding their actual content while for all other objects their location in memory is compared.

Execution Information


Objects1Objects1Objects1Objects1objects1 (input_object)  object(-array) objectHObjectHObjectHobject

Reference objects.

Objects2Objects2Objects2Objects2objects2 (input_object)  object(-array) objectHObjectHObjectHobject

Test objects.

EpsilonEpsilonEpsilonEpsilonepsilon (input_control)  number HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

Maximum allowed difference between two gray values or coordinates etc.

Default value: 0.0

Suggested values: 0.0, 1.e-5

IsEqualIsEqualIsEqualIsEqualisEqual (output_control)  integer HTupleHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Boolean result value.


The operator compare_objcompare_objCompareObjCompareObjCompareObj returns the value 2 (H_MSG_TRUE) if the parameters are correct. The behavior in case of empty input (no input objects available) is set via the operator 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>). If the number of objects differs an exception is raised.

See also

test_equal_objtest_equal_objTestEqualObjTestEqualObjTestEqualObj, test_equal_regiontest_equal_regionTestEqualRegionTestEqualRegionTestEqualRegion