123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360 |
- /*****************************************************************************
- * CORE1.h
- *****************************************************************************
- *
- * Project: HALCON/libhalcon
- * Description: Mid level procedure interface
- *
- * (c) 1996-2022 by MVTec Software GmbH
- * www.mvtec.com
- *
- *****************************************************************************
- *
- *
- */
- #ifndef CORE1_H
- #define CORE1_H
- #include "hlib/DBNew.h" /* -> DBFreeProc */
- #if defined(__cplusplus)
- extern "C" {
- #endif
- /* HPAllocStringMem - allocate memory for StringMem */
- extern HLibExport Herror HPAllocStringMem(Hproc_handle proc_handle,
- size_t size);
- /* HFreeStringMem - give free memory of StringMem */
- extern HLibExport Herror HFreeStringMem(Hproc_handle proc_handle);
- /* HNoInpObj - returns true, if any input object parameter is empty */
- extern HLibExport Herror HNoInpObj(Hproc_handle proc_handle, bool* b);
- /* HPGetObj - get key of a input object */
- extern HLibExport Herror HPGetObj(Hproc_handle proc_handle, int par_num,
- INT4_8 obj_num, Hkey* key);
- /* HPGetOutpObj - get key of a output object */
- extern HLibExport Herror HPGetOutpObj(Hproc_handle proc_handle, int par_num,
- INT4_8 obj_num, Hkey* key);
- /* HPGetObjNum - get number of objects of input object parameter */
- extern HLibExport Herror HPGetObjNum(Hproc_handle proc_handle, int par_num,
- INT4_8* num);
- /* HPTestObj - test, whether key specifies a valid database object */
- extern HLibExport bool HPTestObj(Hkey obj);
- /* HPCountTuple - count number of managed data base objects */
- extern HLibExport Herror HPCountTuple(char* relation, INT4_8* num);
- /* HPGetComp - get key of a component of an object */
- extern HLibExport Herror HPGetComp(Hproc_handle proc_handle, Hkey obj_key,
- int comp, Hkey* key);
- /* HPGetFRL - get runlength code of a region (no copy; just pointer to data) */
- extern HLibExport Herror HPGetFRL(Hproc_handle proc_handle, Hkey rl_key,
- Hrlregion** region);
- /* HPGetFRL - get runlength code of a region (region is copied!) */
- extern HLibExport Herror HPGetRL(Hproc_handle proc_handle, Hkey rl_key,
- Hrlregion* rl);
- /* HPGetFDRL - get runlength code of a region (no copy; just pointer to data)*/
- extern HLibExport Herror HPGetFDRL(Hproc_handle proc_handle, Hkey obj_key,
- Hrlregion** rl);
- /* HPGetDRL - get chord coding of a region (region gets copied!) */
- extern HLibExport Herror HPGetDRL(Hproc_handle proc_handle, Hkey obj_key,
- Hrlregion* rl);
- /* HPGetURL - merge all regions of an object into a new one */
- extern HLibExport Herror HPGetURL(Hproc_handle proc_handle, int par_num,
- Hrlregion* region);
- /* HPGetURLLocal - merge all regions of an object into a new one */
- extern HLibExport Herror HPGetURLLocal(Hproc_handle proc_handle, int par_num,
- Hrlregion** region);
- /* HPGetCParNum - get number of values of input control parameter */
- extern HLibExport Herror HPGetCParNum(Hproc_handle proc_handle, int par_num,
- INT4_8* num);
- /* HPGetPPar - get array of pointers to value structures of inp. ctrl. par. */
- extern HLibExport Herror HPGetPPar(Hproc_handle proc_handle, int par_num,
- Hcpar* H_RESTRICT* val, INT4_8* num);
- /* HPGetPar - get values of input control parameter */
- extern HLibExport Herror HPGetPar(Hproc_handle proc_handle, int par_num,
- int kind_in, int* kind, Hpar Val[],
- INT4_8 min, INT4_8 max, INT4_8* num);
- /* HPGetCPar - get values of input control parameter */
- extern HLibExport Herror HPGetCPar(Hproc_handle proc_handle, int par_num,
- int kind_in, Hcpar Val[], INT4_8 min,
- INT4_8 max, INT4_8* num);
- /* HPPutPElem - store output control parameter values by reference */
- extern HLibExport Herror HPPutPElem(Hproc_handle proc_handle, int parnr,
- void* Val, INT4_8 num, int type);
- /* HPPutElem - store output control parameter values by copy */
- extern HLibExport Herror HPPutElem(Hproc_handle proc_handle, int parnr,
- void const* Val, INT4_8 num, int type);
- /* HPPutPar - store output control parameter values */
- extern HLibExport Herror HPPutPar(Hproc_handle proc_handle, int par_num,
- int kind, Hpar* Elem, INT4_8 num);
- /* HPPutPPar - store output control parameter values (by using pointers) */
- extern HLibExport Herror HPPutPPar(Hproc_handle proc_handle, int par_num,
- Hcpar* Val, INT4_8 num);
- /* HPPutCPar - store output control parameter values */
- extern HLibExport Herror HPPutCPar(Hproc_handle proc_handle, int par_num,
- Hcpar* Val, INT4_8 num);
- /* HPFreeAllParStrings - free all strings in parameter array */
- extern HLibExport Herror HPFreeAllParStrings(Hproc_handle proc_handle,
- Hcpar* par, INT4_8 num);
- /* HPFreeAllParHandles - free all handles in parameter array */
- extern HLibExport Herror HPFreeAllParHandles(Hproc_handle proc_handle,
- Hcpar* par, INT4_8 num);
- /* HPPutRL - copy region into region object, return its key */
- extern HLibExport Herror HPPutRL(Hproc_handle proc_handle, Hrlregion* region,
- Hkey* key);
- /* HPPutPRL - store region into region object, return its key */
- extern HLibExport Herror HPPutPRL(Hproc_handle proc_handle, Hrlregion** region,
- Hkey* key);
- /* HPPutDRL - copy region into component object and return its region
- * object key..*/
- extern HLibExport Herror HPPutDRL(Hproc_handle proc_handle, Hkey obj_key,
- Hrlregion* rl, Hkey* key);
- /* HPPutPRLComp - store region into component object and return its region
- * object key. */
- extern HLibExport Herror HPPutPRLComp(Hproc_handle proc_handle, Hkey obj_key,
- Hrlregion** reg, Hkey* key);
- /* HPPutRect - insert rectangular region in output object */
- extern HLibExport Herror HPPutRect(Hproc_handle proc_handle, Hkey obj,
- int width, int height);
- /* HPGetImage - fetch key of image object from database (including spy) */
- extern HLibExport Herror HPGetImage(Hproc_handle proc_handle, Hkey key,
- Himage* image);
- /* HP0GetImage - fetch key of image object from database (without spy) */
- extern HLibExport Herror HP0GetImage(Hproc_handle proc_handle, Hkey key,
- Himage* image);
- extern HLibExport Herror HPGetImageManip(Hproc_handle proc_handle, Hkey key,
- Himage* image);
- /* HPGetImage - fetch key of image object from database (including spy) */
- extern HLibExport Herror HPGetCDImage(Hproc_handle proc_handle, Hkey key,
- Himage* image);
- /* HP0GetImage - fetch key of image object from database (without spy) */
- extern HLibExport Herror HP0GetCDImage(Hproc_handle proc_handle, Hkey key,
- Himage* image);
- /* HPGetDImage - fetch gray value channel of image object (without key) */
- extern HLibExport Herror HPGetDImage(Hproc_handle proc_handle, Hkey obj_key,
- int comp, Himage* image);
- /* HPDelObj - delete an object */
- extern HLibExport Herror HPDelObj(Hproc_handle proc_handle, Hkey obj_key);
- /* HCrIObj - create new image object */
- extern HLibExport Herror HCrIObj(Hproc_handle proc_handle, Hkey* key);
- /* HPCrObj - create new image object and insert it into output object list */
- extern HLibExport Herror HPCrObj(Hproc_handle proc_handle, int par_num,
- Hkey* key);
- /* HPCopyIObj - copy image object */
- extern HLibExport Herror HPCopyIObj(Hproc_handle proc_handle, Hkey obj_key,
- Hkey* tuple);
- /* HPCopyObj - copy image object and insert it into output object list */
- extern HLibExport Herror HPCopyObj(Hproc_handle proc_handle, Hkey obj_key,
- int par_num, Hkey* key);
- /* HPPutImage - store image data as image object in database */
- extern HLibExport Herror HPPutImage(Hproc_handle proc_handle, Himage* image,
- bool copy, Hkey* key);
- /* HPDefObj - build up new object from already created objhects/components */
- extern HLibExport Herror HPDefObj(Hproc_handle proc_handle, Hkey obj_key,
- Hkey comp_key, int comp);
- /* HPPutDImage - store image data in database and assign it to object */
- extern HLibExport Herror HPPutDImage(Hproc_handle proc_handle, Hkey obj_key,
- int comp, Himage* image, bool copy,
- Hkey* key);
- /* HPNewRegion - create new output object with copied region */
- extern HLibExport Herror HPNewRegion(Hproc_handle proc_handle,
- Hrlregion* region);
- /* HPPushRegion - create new output object with defined region */
- extern HLibExport Herror HPPushRegion(Hproc_handle proc_handle,
- Hrlregion* region);
- /* HPPushGlobalRegion - create new output object with defined region */
- extern HLibExport Herror HPPushGlobalRegion(Hproc_handle proc_handle,
- Hrlregion* region);
- /* HPDupObj - duplicate object and insert it into output object list */
- extern HLibExport Herror HPDupObj(Hproc_handle proc_handle, INT4_8 obj_index);
- /* HPAllSegm - loop over all components of all objects of first input par. */
- extern HLibExport Herror HPAllSegm(Hproc_handle proc_handle, INT4_8 obj_index,
- Hrlregion** region, Himage* images,
- int max_channels);
- /* HPAllReg - loop over all region components of all obj.s of first inp. par.*/
- extern HLibExport Herror HPAllReg(Hproc_handle proc_handle, INT4_8 obj_index,
- Hrlregion** region);
- /* HPAllFilter - loop over all image obj.s of 1. inp. par. & create new obj.*/
- extern HLibExport Herror HPAllFilter(Hproc_handle proc_handle,
- INT4_8 obj_index, Hrlregion** region,
- Himage* images_in, Himage* images_out,
- int max_channels);
- /* HPAllFilter2 - loop over all image obj.s of 1. inp. par. & create new obj.*/
- extern HLibExport Herror HPAllFilter2(Hproc_handle proc_handle,
- INT4_8 obj_index, Hrlregion* region,
- Himage* images_in1, Himage* images_in2,
- Himage* images_out, int max_channels);
- /* HPNumOfChannels - check number of channels of input object */
- extern HLibExport Herror HPNumOfChannels(Hproc_handle proc_handle, int par_num,
- INT4_8 obj_num, int* chn_num);
- /* HPCheckSingleInputObject - check if it is a single input object */
- extern HLibExport Herror HPCheckSingleInputObject(Hproc_handle ph,
- INT4_8 obj_num);
- /* HPCrXLD - create XLD object */
- extern HLibExport Herror HPCrXLD(Hproc_handle proc_handle, int Par, void* XLD,
- int Type, Hkey* Uses, int NumUses,
- DBFreeProc free_proc, Hkey* key);
- /* HPGetXLD - fetch XLD object (in fact void **XLD) */
- extern HLibExport Herror HPGetXLD(Hproc_handle proc_handle, Hkey Key,
- int* Type, void* XLD, Hkey** Uses,
- int* NumUses);
- /* HPNumOfObjChannels - return number of defined channels of an object. */
- extern HLibExport Herror HPNumOfObjChannels(Hproc_handle proc_handle, Hkey obj,
- int* chn_num);
- /* HNumOfOutpObj - return number of objects of an output object parameter */
- extern HLibExport Herror HNumOfOutpObj(Hproc_handle proc_handle, int par_num,
- int* outp_objs);
- /* HGetInputKeyByPtr - get input object key containing ptr */
- extern HLibExport Herror HGetInputKeyByPtr(Hproc_handle proc_id, void* ptr,
- Hkey* key);
- /* HGetOutputKeyByPtr - get output object key containing ptr */
- extern HLibExport Herror HGetOutputKeyByPtr(Hproc_handle proc_id, void* ptr,
- Hkey* key);
- /* HGetInputRegionKeyByPtr - get input object key containing ptr */
- extern HLibExport Herror HGetInputRegionKeyByPtr(Hproc_handle proc_id,
- Hrlregion* ptr, Hkey* key);
- extern HLibExport Herror HPAllocOutpCtrl(Hproc_handle ph, int par, int type,
- INT4_8 length,
- void* H_RESTRICT* elem);
- #define HAllocOutpCtrl(ph, par, type, length, elem) \
- HPAllocOutpCtrl(ph, par, type, length, (void* H_RESTRICT*)elem)
- extern HLibExport Herror HFreeOutpCtrl(Hproc_handle ph, int par);
- extern HLibExport Herror HPReallocOutpCtrl(Hproc_handle ph, int par,
- int newtype, INT4_8 newlength,
- void* H_RESTRICT* elem);
- #define HReallocOutpCtrl(ph, par, type, newlength, elem) \
- HPReallocOutpCtrl(ph, par, type, newlength, (void* H_RESTRICT*)elem)
- extern HLibExport void HSetNumOutpCtrl(Hproc_handle ph, int par, INT4_8 num);
- extern HLibExport void HPGetPElem(Hproc_handle ph, int par,
- void const* H_RESTRICT* elem, INT4_8* num,
- int* type);
- /* definition of conversion flags to pass to convert slot of HPGetPElemx: */
- /* no conversion;do only consider original element types */
- #define CONV_NONE 0
- #define CONV_CAST 1 /* <INT4_8>=(INT4_8)<double>; <double>=(double)<INT4_8>*/
- #define CONV_IDNT 2 /* convert double->INT4_8 if double has no fraction */
- #define CONV_RND 3 /* <INT4_8>=(INT4_8)(<double>+0.5) */
- /* direct access input ctrl arrays */
- extern HLibExport Herror HPGetPElemL(Hproc_handle ph, int par, int convert,
- INT4_8 const* H_RESTRICT* elem,
- INT4_8* num);
- extern HLibExport Herror HPGetPElemD(Hproc_handle ph, int par, int convert,
- double const* H_RESTRICT* elem,
- INT4_8* num);
- extern HLibExport Herror HPGetPElemS(Hproc_handle ph, int par, int convert,
- char const* const* H_RESTRICT* elem,
- INT4_8* num);
- extern HLibExport Herror HPGetPElemH(Hproc_handle ph, int par,
- const HHandleInfo* expected_type,
- INT4_8 expected_num, void** elem,
- INT4_8* num, bool alloc);
- /* copy variant */
- extern HLibExport Herror HPGetElemL(Hproc_handle ph, int par, int convert,
- int memtype, INT4_8* H_RESTRICT* elem,
- INT4_8* num);
- extern HLibExport Herror HPGetElemD(Hproc_handle ph, int par, int convert,
- int memtype, double* H_RESTRICT* elem,
- INT4_8* num);
- extern HLibExport Herror HPGetElemS(Hproc_handle ph, int par, int convert,
- int memtype,
- char* H_RESTRICT* H_RESTRICT* elem,
- INT4_8* num);
- /* copy variant with preallocated arrays */
- extern HLibExport Herror HPCopyElemLFromTuple(Hctuple* H_RESTRICT ctuple,
- int convert,
- INT4_8* H_RESTRICT lelem,
- INT4_8* num);
- extern HLibExport Herror HPCopyElemL(Hproc_handle ph, int par, int convert,
- INT4_8* H_RESTRICT lelem, INT4_8* num);
- extern HLibExport Herror HPCopyElemD(Hproc_handle ph, int par, int convert,
- double* H_RESTRICT delem, INT4_8* num);
- extern HLibExport Herror HPCopyElemF(Hproc_handle ph, int par, int convert,
- float* H_RESTRICT delem, INT4_8* num);
- /* returning handles */
- extern HLibExport Herror HAllocOutputHandles(Hproc_handle ph, int parnr,
- Hphandle** elem, INT4_8 num,
- const HHandleInfo* type);
- extern HLibExport Herror HXAllocOutputHandle(Hproc_handle ph, int parnr,
- void*** elem,
- const HHandleInfo* type);
- extern Herror HcparToBool(Hcpar const* H_RESTRICT par_value, Herror err,
- bool* val);
- #if defined(__cplusplus)
- }
- #endif
- #endif
|