As already noted, we recommend using the object-oriented approach wherever possible. However, there are some reasons for using the procedural approach, e.g., if you want to quickly integrate code that is exported by HDevelop, which can only create procedural code.
The least trouble is caused by the basic control parameters as both approaches use the elementary types long etc. and the class HTuple. Iconic parameters and handles can be converted as follows:
HObject p_image; ReadImage(&p_image, "barcode/ean13/ean1301"); HImage o_image(p_image);
Iconic parameters can be converted from HObject to, e.g., HImage simply by calling the constructor with the procedural variable as a parameter.
HTuple p_barcode; CreateBarCodeModel(HTuple(), HTuple(), &p_barcode); HBarCode o_barcode(p_barcode.H()); o_code_region = o_barcode.FindBarCode(o_image, "EAN-13", &result);
Note that instances of HImage can be used in procedural code where HObject is expected.
As already remarked in section “Destructors and Halcon Operators”, you must not use operators like ClearShapeModel, ClearAllShapeModels, or CloseFramegrabber together with instances of the corresponding handle classes!