Evo 7.12.0-TM26061101
Evo LPR Engine
Loading...
Searching...
No Matches

C APIs. More...

Files

file  Basic.h
 C/C++ header file common to all type of engines and functionalities.
file  C_API.h
 C header file common to all type of engines and functionalities.

Detailed Description

To use the engines, include the header file 'C_API.h' and add 'EvoCAPI.lib' import library on Windows or 'libEvoCAPI.so' shared library on Linux when linked together. For their paths, refer to SDK contents.

Example for Snapshot Engine

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
// Include the header file for the C API.
#include <Evo/C_API.h>
int main(int argc, char *argv[])
{
const char *imgPath = NULL; // Sample Image File Path.
const char *dataDir = NULL; // SDK's data directory
if (argc < 2)
{
fprintf(stderr, "%s [sdk_data_dir] image_file\n", argv[0]);
return EXIT_FAILURE;
}
else if (argc == 2)
{
imgPath = argv[1];
}
else
{
dataDir = argv[1];
imgPath = argv[2];
}
EvoRC rc;
unsigned numDev;
int idSSE; // Snapshot Engine object ID
int idDDI = EVO_INV_OBJ_ID; // DDI object ID. If used, must be set to invalid ID.
// 1. Initialize Evo engine library. Optionally can get DDI object
rc = Evo_Initialize(NULL, dataDir, &idDDI);
assert(rc == EVORC_OK);
// [+] Optionally examine the DDI.
rc = EvoDDI_GetNumDev(idDDI, &numDev); // Get total number of available DNN devices.
assert(rc == EVORC_OK);
fprintf(stdout, "<< Supported DNN Devices >>\n");
for (unsigned i = 0; i < numDev; i++)
{
char buf[128] = { 0 };
// At first, select a specific device.
rc = EvoDDI_SelectDev(idDDI, i);
assert(rc == EVORC_OK);
// Get ID of the selected device.
rc = EvoDDI_GetDevID(idDDI, buf, sizeof(buf));
assert(rc == EVORC_OK);
fprintf(stdout, " ID: %s\n", buf);
// Get full name of the selected device.
rc = EvoDDI_GetFullName(idDDI, buf, sizeof(buf));
assert(rc == EVORC_OK);
fprintf(stdout, " Full Name: %s\n", buf);
if (i < (numDev - 1U))
fprintf(stdout, " --------------------------------------------\n");
}
// Must release the DDI object.
Evo_FreeObj(&idDDI);
assert(idDDI < 0);
// [-]
// 2. Create a Snapshot Engine.
idSSE = EvoSSE_Create();
assert(idSSE >= 0);
// 3. Initialize the engine.
rc = EvoSSE_Init(idSSE, "KOR", NULL);
assert(rc == EVORC_OK);
// 4. If required, set or get the engine parameters of interest.
{
EvoRect searchRect;
rc = EvoEng_GetParam_SearchRect(idSSE, &searchRect);
assert(rc == EVORC_OK);
//searchRect.x = 0;
//searchRect.y = 0;
searchRect.width = 0;
searchRect.height = 0;
rc = EvoEng_SetParam_SearchRect(idSSE, &searchRect);
assert(rc == EVORC_OK);
}
//
// Repeat the stpes 5 ~ 6.
//
int idLPI;
// 5. Run the engine with input image.
idLPI = EvoSSE_Run_ImgFile(idSSE, imgPath);
rc = Evo_GetLastRC(); // Get the return code.
assert(rc == EVORC_OK);
// In case any license plate was found.
if (idLPI >= 0)
{
//
// 6. Examine the LPI.
//
unsigned numLPs;
// Get total number of license plates.
rc = EvoLPI_GetNumLP(idLPI, &numLPs);
assert(rc == EVORC_OK);
for (unsigned i = 0; i < numLPs; i++)
{
// [+] Get string.
char bufCP[512] = { 0 }; // Buffer for string encoded in CodePage
char bufUTF8[512] = { 0 }; // Buffer for string encoded in UTF-8
// At first, select a specific LP.
rc = EvoLPI_SelectLP(idLPI, i);
assert(rc == EVORC_OK);
rc = EvoLPI_GetStr(idLPI, bufUTF8, sizeof(bufUTF8));
assert(rc == EVORC_OK);
#ifdef _WIN64
rc = Evo_CvtUTF8ToCP(bufUTF8, bufCP, sizeof(bufCP));
assert (rc == EVORC_OK);
fprintf(stdout, "\n%s\n", bufCP);
#else // __linux__
fprintf(stdout, "\n%s\n", bufUTF8);
#endif
// [-]
// [+] Get bounding box.
EvoRect bbox;
rc = EvoLPI_GetPos(idLPI, &bbox);
assert(rc == EVORC_OK);
fprintf(stdout, " --> Position: %d, %d, %d, %d\n", bbox.x, bbox.y, bbox.width, bbox.height);
// [-]
// [+] Get type.
EvoLPT type;
float confidence;
rc = EvoLPI_GetType(idLPI, &type, &confidence);
assert(rc == EVORC_OK);
fprintf(stdout, " --> Type: %d (%.2f%%)\n", type, confidence);
// [-]
} // for
// Must release the LPI object.
Evo_FreeObj(&idLPI);
assert(idLPI < 0);
}
// 7. Deinitialize the engine.
EvoSSE_Deinit(idSSE);
// 8. Destory the engine.
Evo_FreeObj(&idSSE);
assert(idSSE < 0);
return EXIT_SUCCESS;
}
EvoRC
Return Codes.
Definition Basic.h:59
int EvoLPT
License Plate Type.
Definition Basic.h:598
C header file common to all type of engines and functionalities.
EvoRC EvoLPI_GetStr(EvoObjID idLPI, char *buf, unsigned len)
void EvoSSE_Deinit(EvoObjID idSSE)
EvoRC Evo_CvtUTF8ToCP(const char *utf8, char *cpBuf, unsigned bufLen)
EvoRC EvoEng_GetParam_SearchRect(EvoObjID idEngine, EvoRect *rect)
EvoRC Evo_GetLastRC(void)
EvoRC EvoDDI_SelectDev(EvoObjID idDDI, unsigned idx)
EvoRC EvoDDI_GetNumDev(EvoObjID idDDI, unsigned *num)
#define EVO_INV_OBJ_ID
Definition C_API.h:30
EvoRC EvoLPI_GetNumLP(EvoObjID idLPI, unsigned *num)
EvoRC EvoSSE_Init(EvoObjID idSSE, const char *ccode, const char *dnnDevDesc)
EvoRC EvoLPI_SelectLP(EvoObjID idLPI, unsigned idx)
EvoRC EvoDDI_GetDevID(EvoObjID idDDI, char *buf, unsigned len)
EvoRC EvoLPI_GetPos(EvoObjID idLPI, EvoRect *rect)
EvoRC EvoLPI_GetType(EvoObjID idLPI, EvoLPT *type, float *confidence)
EvoRC EvoEng_SetParam_SearchRect(EvoObjID idEngine, const EvoRect *rect)
EvoRC EvoDDI_GetFullName(EvoObjID idDDI, char *buf, unsigned len)
EvoObjID EvoSSE_Create(void)
void Evo_FreeObj(EvoObjID *idObj)
EvoObjID EvoSSE_Run_ImgFile(EvoObjID idSSE, const char *imgPath)
EvoRC Evo_Initialize(const char *dnnRunMode, const char *dataDir, EvoObjID *idDDI)
Rectangle Descriptor.
Definition Basic.h:463
int height
Height Size.
Definition Basic.h:467
int x
X Coordinate of Top-Left.
Definition Basic.h:464
int y
Y Coordinate of Top-Left.
Definition Basic.h:465
int width
Width Size.
Definition Basic.h:466

Example for Triggered Snapshot Engine

#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
// Include the header file for the C API.
#include <Evo/C_API.h>
static void Trigger(int idTSSE, const char *imgDir, int num)
{
EvoRC rc;
int idLPI;
int idPic = EVO_INV_OBJ_ID;
char buf[1024] = { 0 };
// Get picture and LPI objects when the event has been triggered.
// 'idPic' must be set to invalid ID whenever 'EvoTSSE_Trigger()' is called.
idLPI = EvoTSSE_Trigger(idTSSE, &idPic);
rc = Evo_GetLastRC();
assert(rc == EVORC_OK);
// In case any license plate was found.
if (idLPI >= 0)
{
//
// Examine the LPI.
//
unsigned numLPs;
// Get total number of license plates.
rc = EvoLPI_GetNumLP(idLPI, &numLPs);
assert(rc == EVORC_OK);
for (unsigned i = 0; i < numLPs; i++)
{
EvoRect bbox;
EvoLPT type;
float confidence;
char bufCP[512] = { 0 }; // Buffer for string encoded in CodePage
char bufUTF8[512] = { 0 }; // Buffer for string encoded in UTF-8
// At first, select a specific LP.
rc = EvoLPI_SelectLP(idLPI, i);
assert(rc == EVORC_OK);
// Get text string.
rc = EvoLPI_GetStr(idLPI, bufUTF8, sizeof(bufUTF8));
assert(rc == EVORC_OK);
#ifdef _WIN64
rc = Evo_CvtUTF8ToCP(bufUTF8, bufCP, sizeof(bufCP));
assert(rc == EVORC_OK);
printf("\n%s\n", bufCP);
#else // __linux__
printf("\n%s\n", bufUTF8);
#endif
// Get bounding box.
rc = EvoLPI_GetPos(idLPI, &bbox);
assert(rc == EVORC_OK);
printf(" --> Position: %d, %d, %d, %d\n", bbox.x, bbox.y, bbox.width, bbox.height);
// Get type.
rc = EvoLPI_GetType(idLPI, &type, &confidence);
assert(rc == EVORC_OK);
printf(" --> Type: %d (%.2f%%)\n", type, confidence);
}
// Must release the LPI object.
Evo_FreeObj(&idLPI);
assert(idLPI < 0);
}
assert(idPic >= 0);
#ifdef _WIN64
sprintf(buf, "%s\\%d.jpg", imgDir, num);
#else // __linux__
sprintf(buf, "%s/%d.jpg", imgDir, num);
#endif
// Save the output image.
EvoPic_SaveInJPEG(idPic, buf, 95);
// Must release the Picture object.
Evo_FreeObj(&idPic);
assert(idPic < 0);
}
int main(int argc, char *argv[])
{
const char *dataDir = NULL; // SDK's data directory
const char *imgDir = NULL; // Directory for the captured images to be saved.
const char *url = NULL; // For example, "rtsp://192.168.1.100/media.smp";
EvoRC rc;
unsigned numDev;
int idTSSE; // Triggered-Snapshot Engine object ID
int idDDI = EVO_INV_OBJ_ID; // DDI object ID. If used, must be set to invalid ID.
if (argc < 3)
{
printf("%s [sdk_data_dir] video_source_url image_dir\n", argv[0]);
return EXIT_FAILURE;
}
else if (argc == 3)
{
url = argv[1];
imgDir = argv[2];
}
else
{
dataDir = argv[1];
url = argv[2];
imgDir = argv[3];
}
// 1. Initialize Evo engine library. Optionally can get DDI object
rc = Evo_Initialize(NULL, dataDir, &idDDI);
assert(rc == EVORC_OK && idDDI >= 0);
// [+] Optionally examine the DDI.
rc = EvoDDI_GetNumDev(idDDI, &numDev); // Get total number of available DNN devices.
assert(rc == EVORC_OK);
printf("<< Supported DNN Devices >>\n");
for (unsigned i = 0; i < numDev; i++)
{
unsigned numDMDF;
char buf[512] = { 0 };
// At first, select a specific device.
rc = EvoDDI_SelectDev(idDDI, i);
assert(rc == EVORC_OK);
// Get ID of the selected DNN device.
rc = EvoDDI_GetDevID(idDDI, buf, sizeof(buf));
assert(rc == EVORC_OK);
fprintf(stdout, " ID: %s\n", buf);
// Get full name of the selected device.
rc = EvoDDI_GetFullName(idDDI, buf, sizeof(buf));
assert(rc == EVORC_OK);
fprintf(stdout, " Full Name: %s\n", buf);
if (i < (numDev - 1U))
fprintf(stdout, " --------------------------------------------\n");
}
// Must release the DDI object.
Evo_FreeObj(&idDDI);
assert(idDDI < 0);
// [-]
// 2. Create a Triggered Snapshot Engine.
idTSSE = EvoTSSE_Create();
assert(idTSSE >= 0);
// 3. Initialize the engine with video source url or GenICam device.
rc = EvoTSSE_Init_IPP(idTSSE, "KOR", NULL, url);
assert(rc == EVORC_OK);
// [+] 4. If required, set or get the engine parameters of interest.
EvoRect searchRect;
rc = EvoEng_GetParam_SearchRect(idTSSE, &searchRect);
assert(rc == EVORC_OK);
searchRect.width = 0;
searchRect.height = 0;
rc = EvoEng_SetParam_SearchRect(idTSSE, &searchRect);
assert(rc == EVORC_OK);
// [-]
int num = 1;
time_t baseTime = time(NULL);
// This emulates asynchronous trigger event using timer.
while (difftime(time(NULL), baseTime) <= 5.0)
{
if ((time_t)difftime(time(NULL), baseTime) == (time_t)num)
{
// 5. Handle the trigger event.
Trigger(idTSSE, imgDir, num++);
}
}
// 6. Deinitialize the engine.
EvoTSSE_Deinit(idTSSE);
// 7. Destory the engine at last.
Evo_FreeObj(&idTSSE);
assert(idTSSE < 0);
return EXIT_SUCCESS;
}
EvoRC EvoPic_SaveInJPEG(EvoObjID idPic, const char *path, int quality)
EvoRC EvoTSSE_Init_IPP(EvoObjID idTSSE, const char *ccode, const char *dnnDevDesc, const char *url)
void EvoTSSE_Deinit(EvoObjID idTSSE)
EvoObjID EvoTSSE_Create(void)
EvoObjID EvoTSSE_Trigger(EvoObjID idTSSE, EvoObjID *idPic)

Example for Fully Automatic Video Engine

#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
// Include the header file for the C API.
#include <Evo/C_API.h>
static void HandleResult(int idLPI, int idGOP, const char *imgDir)
{
EvoRC rc;
EvoLPT type;
unsigned numPic;
float confidence;
EvoHeadDir heading;
unsigned numLPs = 0;
char buf[1024] = { 0 };
char bufCP[512] = { 0 }; // Buffer for string encoded in CodePage
char bufUTF8[512] = { 0 }; // Buffer for string encoded in UTF-8
rc = EvoLPI_GetNumLP(idLPI, &numLPs);
// In case of FAVEngine, the LPI has always single item.
assert(rc == EVORC_OK && numLPs == 1U);
// Get text string.
rc = EvoLPI_GetStr(idLPI, bufUTF8, sizeof(bufUTF8));
assert(rc == EVORC_OK);
#ifdef _WIN64
rc = Evo_CvtUTF8ToCP(bufUTF8, bufCP, sizeof(bufCP));
assert(rc == EVORC_OK);
printf("String: %s\n", bufCP);
#else // __linux__
printf("String: %s\n", bufUTF8);
#endif
// Get type.
rc = EvoLPI_GetType(idLPI, &type, &confidence);
assert(rc == EVORC_OK);
printf("Type: %d (%.2f%%)\n", type, confidence);
rc = EvoGOP_GetNumPic(idGOP, &numPic);
assert(rc == EVORC_OK);
for (unsigned i = 0; i < numPic; i++)
{
EvoRect bbox;
time_t timeRaw;
int64_t timeUTC, timeMS;
struct tm *timeInfo = NULL;
// At first, select specific picture.
rc = EvoGOP_SelectPic(idGOP, i);
assert(rc == EVORC_OK);
// Get bounding box of each picture.
rc = EvoGOP_GetPosInPic(idGOP, &bbox);
assert(rc == EVORC_OK);
printf("Position: %d, %d, %d, %d\n", bbox.x, bbox.y, bbox.width, bbox.height);
// Get time of each picture.
rc = EvoGOP_GetPicTime(idGOP, &timeUTC, EVOTU_MS);
assert(rc == EVORC_OK);
timeMS = timeUTC % 1000;
timeRaw = (time_t)(timeUTC / 1000);
timeInfo = localtime(&timeRaw);
printf("Time: %d-%d-%d %d:%d:%d.%d\n",
timeInfo->tm_year + 1900,
timeInfo->tm_mon + 1,
timeInfo->tm_mday,
timeInfo->tm_hour,
timeInfo->tm_min,
timeInfo->tm_sec,
(int)timeMS);
}
// Get automobile's heading direction.
rc = EvoGOP_GetHeadDir(idGOP, &heading);
assert(rc == EVORC_OK);
printf("Heading Direction: %d\n", heading);
printf("\n");
#ifdef _WIN64
if (numPic < 2U)
sprintf(buf, "%s\\%s.jpg", imgDir, bufCP);
else
sprintf(buf, "%s\\%s.tiff", imgDir, bufCP);
#else // __linux__
if (numPic < 2U)
sprintf(buf, "%s/%s.jpg", imgDir, bufUTF8);
else
sprintf(buf, "%s/%s.tiff", imgDir, bufUTF8);
#endif
// Save the output image.
if (numPic < 2U)
EvoGOP_SavePicInJPEG(idGOP, buf, 95);
else
EvoGOP_SaveAllInTIFF(idGOP, buf, 95);
}
int main(int argc, char *argv[])
{
const char *viType = NULL; // Video Input Type, 'IPProto' or 'GenICam'.
const char *dataDir = NULL; // SDK's data directory
const char *imgDir = NULL; // Directory for the captured images to be saved.
//const char *url = "rtsp://192.168.1.100/media.smp";
const char *url = "F:\\Temp1\\2014-11-24_.mkv";
EvoRC rc;
EvoOutput output;
unsigned numDev; // Number of existing GenICam devices
int idFave; // Triggered-Snapshot Engine Object ID
int idDDI = EVO_INV_OBJ_ID; // DDI Object ID. If used, must be set to invalie ID.
struct {
int idAdmin; // GenICam Administrator Object ID
int idDev; // GenICam Device Object ID
if (argc < 3)
{
printf("%s [SDK_Data_Dir] Video_Input_Type Image_Dir\n", argv[0]);
return EXIT_FAILURE;
}
else if (argc == 3)
{
viType = argv[1];
imgDir = argv[2];
}
else
{
dataDir = argv[1];
viType = argv[2];
imgDir = argv[3];
}
// 1. Initialize Evo engine library. Optionally can get DDI object
rc = Evo_Initialize(NULL, dataDir, &idDDI);
assert(rc == EVORC_OK);
// [+] Optionally examine the DDI.
rc = EvoDDI_GetNumDev(idDDI, &numDev); // Get total number of available DNN devices.
assert(rc == EVORC_OK);
printf("<< Supported DNN Devices >>\n");
for (unsigned i = 0; i < numDev; i++)
{
char buf[256] = { 0 };
// At first, select a specific device.
rc = EvoDDI_SelectDev(idDDI, i);
assert(rc == EVORC_OK);
// Get ID of the selected device.
rc = EvoDDI_GetDevID(idDDI, buf, sizeof(buf));
assert(rc == EVORC_OK);
fprintf(stdout, " ID: %s\n", buf);
// Get full name of the selected device.
rc = EvoDDI_GetFullName(idDDI, buf, sizeof(buf));
assert(rc == EVORC_OK);
fprintf(stdout, " Full Name: %s\n", buf);
if (i < (numDev - 1U))
fprintf(stdout, " --------------------------------------------\n");
}
printf("\n");
// Must release the DDI object.
Evo_FreeObj(&idDDI);
assert(idDDI < 0);
// [-]
if (!strcmp(viType, "GenICam"))
{
gic.idAdmin = EvoGIC_Admin_Get();
assert(gic.idAdmin >= 0);
rc = EvoGIC_Admin_UpdateDevList(gic.idAdmin);
assert(rc == EVORC_OK);
rc = EvoGIC_Admin_GetNumDev(gic.idAdmin, &numDev);
assert(rc == EVORC_OK);
if (numDev <= 0)
return EXIT_FAILURE;
else
{
unsigned numDS;
for (unsigned i = 0; i < numDev; i++)
{
char buf[100] = { 0 };
rc = EvoGIC_Admin_SelectDev(gic.idAdmin, i);
assert(rc == EVORC_OK);
printf("[Current Device: %u]\n", i);
rc = EvoGIC_Admin_GetDevIfc(gic.idAdmin, buf, sizeof(buf));
assert(rc == EVORC_OK);
printf("Interface: %s\n", buf);
rc = EvoGIC_Admin_GetDevVendor(gic.idAdmin, buf, sizeof(buf));
assert(rc == EVORC_OK);
printf("Vendor: %s\n", buf);
rc = EvoGIC_Admin_GetDevModel(gic.idAdmin, buf, sizeof(buf));
assert(rc == EVORC_OK);
printf("Model: %s\n", buf);
rc = EvoGIC_Admin_GetDevSerialNo(gic.idAdmin, buf, sizeof(buf));
assert(rc == EVORC_OK);
printf("SerialNo: %s\n", buf);
rc = EvoGIC_Admin_GetDevID(gic.idAdmin, buf, sizeof(buf));
assert(rc == EVORC_OK);
printf("ID: %s\n", buf);
}
printf("\n");
rc = EvoGIC_Admin_SelectDev(gic.idAdmin, 0);
assert(rc == EVORC_OK);
gic.idDev = EvoGIC_Admin_OpenDev(gic.idAdmin);
assert(gic.idDev >= 0);
rc = EvoGIC_Dev_GetNumDataStreams(gic.idDev, &numDS);
assert(rc == EVORC_OK);
if (numDS > 0)
printf("Number of data streams: %u\n", numDS);
else
return EXIT_FAILURE;
}
}
// 2. Create a Fully Automatic Video engine.
idFave = EvoFAVE_Create();
assert(idFave >= 0);
// 3. Initialize the engine.
if (!strcmp(viType, "IPProto"))
rc = EvoFAVE_Init_IPP(idFave, "KOR", NULL, url);
else // In case of 'GenICam'
rc = EvoFAVE_Init_GIC(idFave, "KOR", NULL, gic.idDev, 0);
assert(rc == EVORC_OK);
// [+] 4. If required, set or get the engine parameters of interest.
rc = EvoEng_GetParam_Output(idFave, &output);
assert(rc == EVORC_OK);
output.headDir = EVO_TRUE;
rc = EvoEng_SetParam_Output(idFave, &output);
assert(rc == EVORC_OK);
// [-]
// 5. Get the LPI and realted images.
for (int num = 0; num < 3; num++)
{
int idLPI;
int idGOP = EVO_INV_OBJ_ID; // Must be reset to invalid ID.
idLPI = EvoFAVE_PopLPI(idFave, &idGOP);
// When errors occured.
if (idLPI < 0 && idGOP < 0)
{
// The video stream has been closed.
if (Evo_GetLastRC() == EVORC_NO_MORE_DATA)
printf("The video stream closed.\n");
break;
}
assert(idLPI >= 0 && idGOP >= 0);
HandleResult(idLPI, idGOP, imgDir);
// Must release the LPI and GOP objects.
Evo_FreeObj(&idLPI);
assert(idLPI < 0);
Evo_FreeObj(&idGOP);
assert(idGOP < 0);
}
// 6. Deinitialize the engine.
EvoFAVE_Deinit(idFave);
// 7. Destory the engine.
Evo_FreeObj(&idFave);
assert(idFave < 0);
if (!strcmp(viType, "GenICam"))
{
// At first, close the GenICam device
Evo_FreeObj(&gic.idDev);
assert(gic.idDev < 0);
Evo_FreeObj(&gic.idAdmin);
assert(gic.idAdmin < 0);
}
return EXIT_SUCCESS;
}
EvoHeadDir
Automobile's Heading Directions.
Definition Basic.h:277
@ EVOTU_MS
Definition Basic.h:425
EvoRC EvoGIC_Admin_GetNumDev(EvoObjID idAdmin, unsigned *num)
void EvoFAVE_Deinit(EvoObjID idFAVE)
EvoObjID EvoGIC_Admin_Get(void)
EvoRC EvoGIC_Admin_UpdateDevList(EvoObjID idAdmin)
EvoObjID EvoFAVE_PopLPI(EvoObjID idFAVE, EvoObjID *idGOP)
EvoRC EvoEng_GetParam_Output(EvoObjID idEngine, EvoOutput *output)
EvoObjID EvoFAVE_Create(void)
EvoRC EvoGIC_Dev_GetNumDataStreams(EvoObjID idDev, unsigned *num)
EvoRC EvoGIC_Admin_SelectDev(EvoObjID idAdmin, unsigned idx)
EvoRC EvoGIC_Admin_GetDevIfc(EvoObjID idAdmin, char *buf, unsigned len)
EvoRC EvoGIC_Admin_GetDevID(EvoObjID idAdmin, char *buf, unsigned len)
EvoRC EvoGOP_SelectPic(EvoObjID idGOP, unsigned idx)
EvoRC EvoGOP_SaveAllInTIFF(EvoObjID idGOP, const char *path, int quality)
EvoRC EvoGOP_GetPosInPic(EvoObjID idGOP, EvoRect *rect)
EvoRC EvoGOP_GetPicTime(EvoObjID idGOP, int64_t *time, EvoTimeUnit unit)
EvoRC EvoGIC_Admin_GetDevVendor(EvoObjID idAdmin, char *buf, unsigned len)
EvoObjID EvoGIC_Admin_OpenDev(EvoObjID idAdmin)
EvoRC EvoEng_SetParam_Output(EvoObjID idEngine, const EvoOutput *output)
EvoRC EvoGOP_SavePicInJPEG(EvoObjID idGOP, const char *path, int quality)
EvoRC EvoFAVE_Init_IPP(EvoObjID idFAVE, const char *ccode, const char *dnnDevDesc, const char *url)
EvoRC EvoGIC_Admin_GetDevModel(EvoObjID idAdmin, char *buf, unsigned len)
EvoRC EvoGOP_GetNumPic(EvoObjID idGOP, unsigned *num)
EvoRC EvoGOP_GetHeadDir(EvoObjID idGOP, EvoHeadDir *heading)
EvoRC EvoFAVE_Init_GIC(EvoObjID idFAVE, const char *ccode, const char *dnnDevDesc, EvoObjID idDev, unsigned idxDS)
EvoRC EvoGIC_Admin_GetDevSerialNo(EvoObjID idAdmin, char *buf, unsigned len)
Engine's Output Configurations.
Definition Basic.h:301
EvoBool headDir
Definition Basic.h:305

Example for camera calibration

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
// Include the header file for the C API.
#include <Evo/C_API.h>
int main(int argc, char *argv[])
{
const char *imgPath = NULL; // Sample Image File Path.
const char *calibName = NULL; // Camera Calibration Name
const char *dataDir = NULL; // SDK's data directory
if (argc < 3)
{
fprintf(stderr, "%s [sdk_data_dir] camera_calib_name image_file\n", argv[0]);
return EXIT_FAILURE;
}
else if (argc == 3)
{
calibName = argv[1];
imgPath = argv[2];
}
else
{
dataDir = argv[1];
calibName = argv[2];
imgPath = argv[3];
}
EvoRC rc;
int idSSE;
int idFisheyeModel; // Fisheye Camera Model
// 1. Initialize Evo engine library.
rc = Evo_Initialize("latency", dataDir, NULL);
assert(rc == EVORC_OK);
// 2. Create fisheye camera model.
idFisheyeModel = EvoCC_Fisheye_Create(calibName);
assert(idFisheyeModel >= 0);
// 3. Create a Snapshot Engine.
idSSE = EvoSSE_Create();
assert(idSSE >= 0);
// 4. Initialize the engine.
rc = EvoSSE_Init(idSSE, "KOR", NULL);
assert(rc == EVORC_OK);
int idLPI;
int idPic;
EvoImage img;
//
// If there are more input images, repeat the stpes 5 ~ 8.
//
// 5. Get rectified image.
idPic = EvoCC_Fisheye_Rectify_ImgFile(idFisheyeModel, imgPath);
assert(idPic >= 0);
// 6. [+] Run the engine with the rectified image.
rc = EvoPic_GetImage(idPic, &img);
assert(rc == EVORC_OK);
idLPI = EvoSSE_Run_ImgData(idSSE, &img);
rc = Evo_GetLastRC(); // Get the return code.
assert(rc == EVORC_OK);
// [-]
// In case any license plate was found.
if (idLPI >= 0)
{
//
// 7. Examine the LPI.
//
unsigned numLPs;
// Get total number of license plates.
rc = EvoLPI_GetNumLP(idLPI, &numLPs);
assert(rc == EVORC_OK);
for (unsigned i = 0; i < numLPs; i++)
{
// [+] Get string.
char bufCP[512] = { 0 }; // Buffer for string encoded in CodePage
char bufUTF8[512] = { 0 }; // Buffer for string encoded in UTF-8
rc = EvoLPI_SelectLP(idLPI, i);
assert(rc == EVORC_OK);
rc = EvoLPI_GetStr(idLPI, bufUTF8, sizeof(bufUTF8));
assert(rc == EVORC_OK);
#ifdef _WIN64
rc = Evo_CvtUTF8ToCP(bufUTF8, bufCP, sizeof(bufCP));
assert (rc == EVORC_OK);
fprintf(stdout, "\n%s\n", bufCP);
#else // __linux__
fprintf(stdout, "\n%s\n", bufUTF8);
#endif
// [-]
// [+] Get bounding box.
EvoRect bbox;
rc = EvoLPI_GetPos(idLPI, &bbox);
assert(rc == EVORC_OK);
fprintf(stdout, " --> Position: %d, %d, %d, %d\n", bbox.x, bbox.y, bbox.width, bbox.height);
// [-]
// [+] Get type.
EvoLPT type;
float confidence;
rc = EvoLPI_GetType(idLPI, &type, &confidence);
assert(rc == EVORC_OK);
fprintf(stdout, " --> Type: %d (%.2f%%)\n", type, confidence);
// [-]
} // for
// Must release the LPI object.
Evo_FreeObj(&idLPI);
assert(idLPI < 0);
}
// If required, save the rectified image.
rc = EvoPic_SaveInJPEG(idPic, "rectified_image.jpg", 100);
assert(rc == EVORC_OK);
// 8. Release the rectified image.
Evo_FreeObj(&idPic);
assert(idPic < 0);
// 9. Deinitialize the engine.
EvoSSE_Deinit(idSSE);
// 10. Destory the engine.
Evo_FreeObj(&idSSE);
assert(idSSE < 0);
// 11. Destory the camera model.
Evo_FreeObj(&idFisheyeModel);
assert(idFisheyeModel < 0);
return EXIT_SUCCESS;
}
EvoObjID EvoSSE_Run_ImgData(EvoObjID idSSE, const EvoImage *data)
EvoObjID EvoCC_Fisheye_Create(const char *calibName)
EvoRC EvoPic_GetImage(EvoObjID idPic, EvoImage *img)
EvoObjID EvoCC_Fisheye_Rectify_ImgFile(EvoObjID idFisheye, const char *imgPath)
Image Descriptor.
Definition Basic.h:510