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

C# APIs.

To use the engines, Linked together the library 'EvoCSAPI.dll'. For its path, refer to SDK contents.

Example for Snapshot Engine

using System;
using System.Text;
using System.Drawing;
using System.Diagnostics;
using Evo;
namespace SampleSSE
{
using EvoRC = System.Int32; // Return Code
using EvoObjID = System.Int32; // Object ID
class Program
{
static void Main(string[] args)
{
string dataDir = null; // SDK's Data Directory Path
string imgPath = null; // Input Image File Path
if (args.Length < 1)
{
Console.WriteLine("Usage: SampleSSE [sdk_data_dir] image_file");
return;
}
else if (args.Length == 1)
{
imgPath = args[1];
}
else
{
dataDir = args[0];
imgPath = args[1];
}
EvoRC rc;
EvoObjID idDDI = -1; // DDI Object ID.
// Must be set to negative number.
// 1. Initialize the Evo engine library. Optionally can get DDI object.
rc = Evo.Func.Initialize(null, dataDir, out idDDI);
Debug.Assert(rc == 0);
// [+] Optionally examine the DDI.
uint numDev;
// Get total number of available DNN devices.
rc = Evo.DDI.GetNumDev(idDDI, out numDev);
Debug.Assert(rc == 0);
Console.WriteLine("<< DNN Device Information >>");
for (uint i = 0; i < numDev; i++)
{
StringBuilder buf = new StringBuilder(128);
// At first, select a specific device.
rc = Evo.DDI.SelectDev(idDDI, i);
Debug.Assert(rc == 0);
// Get ID of the selected DNN device.
rc = Evo.DDI.GetDevID(idDDI, buf);
Debug.Assert(rc == 0);
Console.WriteLine(" ID: " + buf);
// Get full name of the selected DNN device.
rc = Evo.DDI.GetFullName(idDDI, buf);
Debug.Assert(rc == 0);
Console.WriteLine(" Full Name: " + buf);
if (i < (numDev - 1))
Console.WriteLine("-----------------------------------------");
}
Console.WriteLine();
// Must release the DDI context.
Evo.Func.FreeObj(ref idDDI);
// [-]
EvoObjID idSSE; // Snapshot Engine object ID
// 2. Create a Snapshot Engine.
idSSE = Evo.SSEngine.Create();
Debug.Assert(idSSE >= 0);
// 3. Initialize the engine.
rc = Evo.SSEngine.Init(idSSE, "KOR", null);
Debug.Assert(rc == 0);
// [+] 4. If required, set or get engine parameters of interest.
Evo.Rect searchRect = new Evo.Rect();
rc = Evo.Engine.GetParamSearchRect(idSSE, out searchRect);
Debug.Assert(rc == 0);
//searchRect.x = 0;
//searchRect.y = 0;
searchRect.width = 0;
searchRect.height = 0;
rc = Evo.Engine.SetParamSearchRect(idSSE, in searchRect);
Debug.Assert(rc == 0);
// [-]
//
// Repeat the stpes 5 ~ 6.
//
EvoObjID idLPI;
// 5. Run the engine with input image.
idLPI = Evo.SSEngine.Run(idSSE, imgPath);
rc = Evo.Func.GetLastRC();
Debug.Assert(rc == 0);
// In case any license plate was found.
if (idLPI >= 0)
{
uint num;
//
// 6. Examine the LPI context.
//
// Get total number of the detected license plates.
rc = Evo.LPI.GetNumLP(idLPI, out num);
Debug.Assert(rc == 0);
for (uint i = 0; i < num; i++)
{
Evo.Rect bbox;
int type;
uint len;
float confidence;
float[] bufCC = new float[20]; // Buffer of Character Confidences
StringBuilder bufStr = new StringBuilder(512);
// At first, select a specific device.
rc = Evo.LPI.SelectLP(idLPI, i);
Debug.Assert(rc == 0);
// Get text string.
rc = Evo.LPI.GetStr(idLPI, bufStr);
Debug.Assert(rc == 0);
Console.WriteLine("\n{0}", bufStr.ToString());
// Get character confidences.
len = (uint)bufCC.Length;
rc = Evo.LPI.GetCharConf(idLPI, bufCC, ref len);
Debug.Assert(rc == 0);
Console.Write(" --> Char Confidences: ");
for (uint j = 0; j < len; j++)
Console.Write("{0}% ", bufCC[j]);
Console.WriteLine();
// Get the bounding box.
rc = Evo.LPI.GetPos(idLPI, out bbox);
Debug.Assert(rc == 0);
Console.WriteLine(" --> Position: {0}, {1}, {2}, {3}", bbox.x, bbox.y, bbox.width, bbox.height);
// Get the type and its confidence.
rc = Evo.LPI.GetType(idLPI, out type, out confidence);
Debug.Assert(rc == 0);
Console.WriteLine(" --> Type: {0} ({1}%)", type, confidence);
}
// Must release the LPI object.
Evo.Func.FreeObj(ref idLPI);
Debug.Assert(idLPI < 0);
}
// 7. Deinitialize the engine.
Evo.SSEngine.Deinit(idSSE);
// 8. Destroy the engine.
Evo.Func.FreeObj(ref idSSE);
Debug.Assert(idSSE < 0);
}
}
}
EvoRC
Return Codes.
Definition Basic.h:59
int EvoObjID
Definition C_API.h:25
Evo Engine's topmost namespace
Definition CamCalib.hpp:27

Example for Triggered Snapshot Engine

using System;
using System.Text;
using System.Timers;
using System.Drawing;
using System.Threading;
using System.Diagnostics;
using Evo;
namespace SampleTSSE
{
using EvoRC = System.Int32; // Return Code
using EvoObjID = System.Int32; // Object ID
class Program
{
private static System.Timers.Timer timer;
private static string imgDir = null; // Directory for the mages to be saved.
private static EvoObjID idTSSE = -1; // Triggered Snapshot Engine object ID
private static void OnTimerHandler(Object source, ElapsedEventArgs e)
{
EvoRC rc;
long time;
EvoObjID idLPI; // LPI object ID
EvoObjID idPic = -1; // Picture object ID.
// Must be set to negative number.
idLPI = Evo.TSSEngine.Trigger(idTSSE, out idPic);
rc = Evo.Func.GetLastRC();
if (rc != 0) // When errors occur.
{
Debug.Assert(idLPI < 0 && idPic < 0);
if (rc == 60) // When the video stream has been closed.
{
Console.WriteLine("The video stream closed.");
return;
}
else
{
Debug.Assert(false);
}
}
if (idLPI >= 0)
{
uint numLPs;
// Get total number of the detected license plates.
rc = Evo.LPI.GetNumLP(idLPI, out numLPs);
Debug.Assert(rc == 0);
for (uint i = 0; i < numLPs; i++)
{
Evo.Rect bbox;
int type;
float confidence;
StringBuilder buf = new StringBuilder(512);
// At first, select the required LP.
rc = Evo.LPI.SelectLP(idLPI, i);
Debug.Assert(rc == 0);
// Get text string.
rc = Evo.LPI.GetStr(idLPI, buf);
Debug.Assert(rc == 0);
Console.WriteLine("\n{0}", buf.ToString());
// Get the bounding box.
rc = Evo.LPI.GetPos(idLPI, out bbox);
Debug.Assert(rc == 0);
Console.WriteLine(" --> Position: {0}, {1}, {2}, {3}", bbox.x, bbox.y, bbox.width, bbox.height);
// Get the type and its confidence.
rc = Evo.LPI.GetType(idLPI, out type, out confidence);
Debug.Assert(rc == 0);
Console.WriteLine(" --> Type: {0} ({1}%)", type, confidence);
}
// Must release the LPI object.
Evo.Func.FreeObj(ref idLPI);
Debug.Assert(idLPI < 0);
}
//
// TimeUnit
// 0 : Second Unit
// 1 : Millisecond Unit
//
rc = Evo.Picture.GetTime(idPic, out time);
Debug.Assert(rc == 0);
rc = Evo.Picture.SaveInJPEG(idPic, imgDir + String.Format("\\{0}.jpg", time));
Debug.Assert(rc == 0);
// Must release the Picture object.
Evo.Func.FreeObj(ref idPic);
Debug.Assert(idPic < 0);
}
static void Main(string[] args)
{
string dataDir = null; // SDK's Data Directory Path
string url = null; // Video Source URL
if (args.Length < 2)
{
Console.WriteLine("Usage: SampleTSSE [sdk_data_dir] video_source_url image_dir");
return;
}
else if (args.Length == 2)
{
url = args[0];
imgDir = args[1];
}
else
{
dataDir = args[0];
url = args[1];
imgDir = args[2];
}
int rc;
EvoObjID idDDI = -1; // DDI Object ID.
// Must be set to negative number.
// 1. Initialize the Evo engine library. Optionally can get DDI context
rc = Evo.Func.Initialize(null, dataDir, out idDDI);
Debug.Assert(rc == 0 && idDDI >= 0);
// [+] Optionally examine the DDI.
uint numDev;
// Get total number of available DNN devices.
rc = Evo.DDI.GetNumDev(idDDI, out numDev);
Debug.Assert(rc == 0);
Console.WriteLine("<< DNN Device Information >>");
for (uint i = 0; i < numDev; i++)
{
StringBuilder buf = new StringBuilder(128);
// At first, select the required device.
rc = Evo.DDI.SelectDev(idDDI, i);
Debug.Assert(rc == 0);
// Get ID of the selected DNN device.
rc = Evo.DDI.GetDevID(idDDI, buf);
Debug.Assert(rc == 0);
Console.WriteLine(" ID: " + buf);
// Get full name of the selected DNN device.
rc = Evo.DDI.GetFullName(idDDI, buf);
Debug.Assert(rc == 0);
Console.WriteLine(" Full Name: " + buf);
if (i < (numDev - 1))
Console.WriteLine("-----------------------------------------");
}
Console.WriteLine();
// Must release the DDI context.
Evo.Func.FreeObj(ref idDDI);
Debug.Assert(idDDI < 0);
// [-]
// 2. Create a Triggered Snapshot Engine.
idTSSE = Evo.TSSEngine.Create();
Debug.Assert(idTSSE >= 0);
// 3. Initialize the engine with video source URL or GenICam device.
rc = Evo.TSSEngine.Init(idTSSE, "KOR", null, url);
Debug.Assert(rc == 0);
// [+] 4. If required, set or get engine parameters of interest.
Evo.Rect searchRect = new Evo.Rect();
rc = Evo.Engine.GetParamSearchRect(idTSSE, out searchRect);
Debug.Assert(rc == 0);
//searchRect.x = 0;
//searchRect.y = 0;
searchRect.width = 0;
searchRect.height = 0;
rc = Evo.Engine.SetParamSearchRect(idTSSE, in searchRect);
Debug.Assert(rc == 0);
// [-]
int total = 5;
// Setup timer to emulate the trigger event.
timer = new System.Timers.Timer(1000);
timer.Elapsed += OnTimerHandler;
timer.AutoReset = true;
timer.Enabled = true;
for (int num = 0; num < total; num++)
{
Thread.Sleep(1000);
}
timer.Enabled = false;
Thread.Sleep(1500); // To gurantee for the timer handler to terminate safely.
// 5. Deinitialize the engine.
Evo.TSSEngine.Deinit(idTSSE);
// 6. Destroy the engine.
Evo.Func.FreeObj(ref idTSSE);
Debug.Assert(idTSSE < 0);
} // Main()
} // Program class
}
Picture class
Definition Picture.hpp:19
virtual int64_t GetTime(EvoTimeUnit unit=EVOTU_MS) const =0
Triggered Snapshot Engine class.
Definition TSSEngine.hpp:33
virtual LPI::Ptr Trigger(Picture::Ptr &pic, EvoMS *mstg=NULL)=0

Example for Fully Automatic Video Engine

using System;
using System.Text;
using System.Timers;
using System.Drawing;
using System.Threading;
using System.Diagnostics;
using Evo;
namespace SampleFAVE
{
using EvoRC = System.Int32; // Return Code
using EvoObjID = System.Int32; // Object ID
class Program
{
private static string imgDir = null; // Directory for the mages to be saved.
private static void HandleResult(EvoObjID idLPI, EvoObjID idGOP)
{
EvoRC rc;
uint numLPs;
// In case of FAVEngine, always return LPI with single element.
rc = Evo.LPI.GetNumLP(idLPI, out numLPs);
Debug.Assert(rc == 0 && numLPs == 1);
int type;
uint numPic;
int heading;
float confidence;
StringBuilder buf = new StringBuilder(512);
// Get text string.
rc = Evo.LPI.GetStr(idLPI, buf);
Debug.Assert(rc == 0);
Console.WriteLine("String: {0}", buf.ToString());
// Get the type and its confidence.
rc = Evo.LPI.GetType(idLPI, out type, out confidence);
Debug.Assert(rc == 0);
Console.WriteLine("Type: {0} ({1}%)", type, confidence);
// Get number of pictures
rc = Evo.GOP.GetNumPic(idGOP, out numPic);
Debug.Assert(rc == 0);
for (uint i = 0; i < numPic; i++)
{
long time;
Evo.Rect bbox;
DateTimeOffset date;
// At first, select a specific picture.
rc = Evo.GOP.SelectPic(idGOP, i);
Debug.Assert(rc == 0);
// Get the bounding box of each picture.
rc = Evo.GOP.GetPos(idGOP, out bbox);
Debug.Assert(rc == 0);
Console.WriteLine("Position: {0}, {1}, {2}, {3}", bbox.x, bbox.y, bbox.width, bbox.height);
//
// Get time of each picture.
//
// TimeUnit
// 0 : Second Unit
// 1 : Millisecond Unit
//
rc = Evo.GOP.GetPicTime(idGOP, out time);
Debug.Assert(rc == 0);
date = DateTimeOffset.FromUnixTimeMilliseconds(time).ToLocalTime();
Console.WriteLine(date.ToString());
}
// Get the heading direction of automobile.
rc = Evo.GOP.GetHeadDir(idGOP, out heading);
Console.WriteLine("Heading Direction: {0}", heading);
Console.WriteLine();
if (numPic < 2)
rc = Evo.GOP.SavePicInJPEG(idGOP, imgDir + String.Format("\\{0}.jpg", buf.ToString()));
else
rc = Evo.GOP.SaveAllInTIFF(idGOP, imgDir + String.Format("\\{0}.tiff", buf.ToString()));
Debug.Assert(rc == 0);
}
public class GenICam
{
public EvoObjID idAdmin; // GenICam Administrator object ID
public EvoObjID idDev; // GenICam Device object ID
public GenICam()
{
idAdmin = -1;
idDev = -1;
}
}
static void Main(string[] args)
{
string viType; // Video Input Type, 'IPProto' or 'GenICam'.
string dataDir = null; // SDK's Data Directory Path
//string url = "rtsp://192.168.1.100/media.smp";
string url = "F:\\Temp1\\2014-11-24_.mkv";
GenICam gic = new GenICam();
if (args.Length < 2)
{
Console.WriteLine("Usage: SampleFAVE [SDK_Data_Dir] Video_Input_Type Image_Dir");
return;
}
else if (args.Length == 2)
{
viType = args[0];
imgDir = args[1];
}
else
{
dataDir = args[0];
viType = args[1];
imgDir = args[2];
}
EvoRC rc;
EvoObjID idDDI = -1; // DDI object ID.
// Must be set to negative number.
// 1. Initialize the Evo engine library. Optionally get DDI object.
rc = Evo.Func.Initialize(null, dataDir, out idDDI);
Debug.Assert(rc == 0 && idDDI >= 0);
// [+] Optionally examine the DDI.
uint numDev;
// Get total number of available DNN devices.
rc = Evo.DDI.GetNumDev(idDDI, out numDev);
Debug.Assert(rc == 0);
Console.WriteLine("<< DNN Device Information >>");
for (uint i = 0; i < numDev; i++)
{
StringBuilder buf = new StringBuilder(128);
// At first, select a specific device
rc = Evo.DDI.SelectDev(idDDI, i);
Debug.Assert(rc == 0);
// Get ID of the selected device.
rc = Evo.DDI.GetDevID(idDDI, buf);
Debug.Assert(rc == 0);
Console.WriteLine(" ID: " + buf);
// Get full name of the selected DNN device.
rc = Evo.DDI.GetFullName(idDDI, buf);
Debug.Assert(rc == 0);
Console.WriteLine(" Full Name: " + buf);
if (i < (numDev - 1))
Console.WriteLine("-----------------------------------------");
}
Console.WriteLine();
// Must release the DDI object.
Evo.Func.FreeObj(ref idDDI);
Debug.Assert(idDDI < 0);
// [-]
if (viType == "GenICam")
{
gic.idAdmin = Evo.GIC.Admin.Get();
Debug.Assert(gic.idAdmin >= 0);
rc = Evo.GIC.Admin.UpdateDevList(gic.idAdmin);
Debug.Assert(rc == 0);
rc = Evo.GIC.Admin.GetNumDev(gic.idAdmin, out numDev);
Debug.Assert(rc == 0);
if (numDev <= 0)
{
// Must release the administrator object.
Evo.Func.FreeObj(ref gic.idAdmin);
Debug.Assert(gic.idAdmin < 0);
return;
}
else
{
uint numDS;
for (uint i = 0; i < numDev; i++)
{
StringBuilder strBuf = new StringBuilder(100);
rc = Evo.GIC.Admin.SelectDev(gic.idAdmin, i);
Debug.Assert(rc == 0);
Console.WriteLine("[Current Device: {0}]", i);
rc = Evo.GIC.Admin.GetDevIfc(gic.idAdmin, strBuf);
Debug.Assert(rc == 0);
Console.WriteLine("Interface: {0}", strBuf.ToString());
rc = Evo.GIC.Admin.GetDevVendor(gic.idAdmin, strBuf);
Debug.Assert(rc == 0);
Console.WriteLine("Vendor: {0}", strBuf.ToString());
rc = Evo.GIC.Admin.GetDevModel(gic.idAdmin, strBuf);
Debug.Assert(rc == 0);
Console.WriteLine("Model: {0}", strBuf.ToString());
rc = Evo.GIC.Admin.GetDevSerialNo(gic.idAdmin, strBuf);
Debug.Assert(rc == 0);
Console.WriteLine("SerialNo: {0}", strBuf.ToString());
rc = Evo.GIC.Admin.GetDevID(gic.idAdmin, strBuf);
Debug.Assert(rc == 0);
Console.WriteLine("ID: {0}", strBuf.ToString());
}
Console.WriteLine();
rc = Evo.GIC.Admin.SelectDev(gic.idAdmin, 0);
Debug.Assert(rc == 0);
gic.idDev = Evo.GIC.Admin.OpenDev(gic.idAdmin);
Debug.Assert(gic.idDev >= 0);
rc = Evo.GIC.Dev.GetNumDataStreams(gic.idDev, out numDS);
Debug.Assert(rc == 0);
if (numDS > 0)
Console.WriteLine("Number of data streams: {0}", numDS);
else
{
// Must release the GenICam objects.
Evo.Func.FreeObj(ref gic.idDev); // At first, release the device object.
Evo.Func.FreeObj(ref gic.idAdmin);
Debug.Assert(gic.idDev < 0 && gic.idDev < 0);
return;
}
}
}
// [+] 2. Create a Fully Automatic Video Engine.
EvoObjID idFAVE = -1;
idFAVE = Evo.FAVEngine.Create();
Debug.Assert(idFAVE >= 0);
// [-]
// 3. Initialize the engine with video source URL or GenICam device.
if (viType == "IPProto")
rc = Evo.FAVEngine.Init(idFAVE, "KOR", null, url);
else
rc = Evo.FAVEngine.Init(idFAVE, "KOR", null, gic.idDev, 0);
Debug.Assert(rc == 0);
// [+] 4. If required, set or get engine parameters of interest.
Evo.Output output = new Evo.Output();
rc = Evo.Engine.GetParamOutput(idFAVE, out output);
Debug.Assert(rc == 0);
output.headDir = 1;
rc = Evo.Engine.SetParamOutput(idFAVE, in output);
Debug.Assert(rc == 0);
rc = Evo.Engine.SetParamGOPSize(idFAVE, 1);
Debug.Assert(rc == 0);
// [-]
// 5. Get the LPI and GOP objects.
for (int num = 0; num < 3; num++)
{
EvoObjID idLPI;
EvoObjID idGOP = -1; // Must be negative number.
idLPI = Evo.FAVEngine.PopLPI(idFAVE, out idGOP);
// When errors occured.
if (idLPI < 0 && idGOP < 0)
{
// The video stream has been closed.
if (Evo.Func.GetLastRC() == 60)
Console.WriteLine("The video stream closed.");
break;
}
Debug.Assert(idLPI >=0 && idGOP >= 0);
HandleResult(idLPI, idGOP);
// Must release the 'LPI' and 'GOP' objects.
Evo.Func.FreeObj(ref idLPI);
Evo.Func.FreeObj(ref idGOP);
Debug.Assert(idLPI < 0 && idGOP < 0);
}
// 6. Deinitialize the engine object.
Evo.FAVEngine.Deinit(idFAVE);
// 7. Destroy the engine object.
Evo.Func.FreeObj(ref idFAVE);
Debug.Assert(idFAVE < 0);
if (viType == "GenICam")
{
// Must release the GenICam objects.
Evo.Func.FreeObj(ref gic.idDev); // At first, release the device object.
Evo.Func.FreeObj(ref gic.idAdmin);
Debug.Assert(gic.idDev < 0 && gic.idDev < 0);
}
} // Main()
} // Program class
}
Goup of Pictures.
Definition FAVEngine.hpp:34
virtual EvoRC SaveAllInTIFF(const char *path, int quality=95) const =0
virtual size_t GetNumPic(void) const =0
virtual EvoHeadDir GetHeadDir(void) const =0
virtual int64_t GetPicTime(EvoTimeUnit unit=EVOTU_MS) const =0
virtual EvoRC SelectPic(size_t idx)=0
virtual EvoRC SavePicInJPEG(const char *path, int quality=95) const =0
License Plate Information class.
Definition Engine.hpp:143
virtual size_t GetNumLP(void) const =0
virtual void GetType(EvoLPT &type, float &confidence) const =0
virtual const char * GetStr(void) const =0

Example for camera calibration

using System;
using System.Text;
using System.Drawing;
using System.Diagnostics;
using Evo;
namespace SampleCamCalib
{
using EvoRC = System.Int32; // Return Code
using EvoObjID = System.Int32; // Object ID
class Program
{
static void Main(string[] args)
{
string dataDir = null; // SDK's Data Directory Path
string ccName = null; // Camera Calibration Name
string imgPath = null; // Input Image File Path
if (args.Length < 2)
{
Console.WriteLine("Usage: SampleCamModel [sdk_data_dir] camera_calib_name image_file");
return;
}
else if (args.Length == 2)
{
ccName = args[0];
imgPath = args[1];
}
else
{
dataDir = args[0];
ccName = args[1];
imgPath = args[2];
}
EvoRC rc;
EvoObjID idSSE = -1;
EvoObjID idFisheyeModel = -1; // Fisheye Camera Model
// 1. Initialize Evo engine library.
rc = Evo.Func.Initialize("latency", dataDir);
Debug.Assert(rc == 0);
// 2. Create fisheye camera model.
idFisheyeModel = Evo.CC.Fisheye.Create(ccName);
Debug.Assert(idFisheyeModel >= 0);
// 3. Create a Snapshot Engine.
idSSE = Evo.SSEngine.Create();
Debug.Assert(idSSE >= 0);
// 4. Initialize the engine.
rc = Evo.SSEngine.Init(idSSE, "KOR", "FP32:CPU");
Debug.Assert(rc == 0);
EvoObjID idLPI = -1;
EvoObjID idPic = -1;
Evo.Image img = new Evo.Image();
//
// If there are more input images, repeat the stpes 5 ~ 8.
//
// 5. Get rectified image.
idPic = Evo.CC.Fisheye.Rectify(idFisheyeModel, imgPath);
Debug.Assert(idPic >= 0);
// 6. [+] Run the engine with the rectified image.
rc = Evo.Picture.GetImage(idPic, out img);
Debug.Assert(rc == 0);
idLPI = Evo.SSEngine.Run(idSSE, in img);
rc = Evo.Func.GetLastRC();
Debug.Assert(rc == 0);
// [-]
// In case any license plate was found.
if (idLPI >= 0)
{
uint num;
//
// 7. Examine the LPI context.
//
// Get total number of the detected license plates.
rc = Evo.LPI.GetNumLP(idLPI, out num);
Debug.Assert(rc == 0);
for (uint i = 0; i < num; i++)
{
Evo.Rect bbox;
int type;
uint len;
float confidence;
float[] bufCC = new float[20]; // Buffer of Character Confidences
StringBuilder strBuf = new StringBuilder(512);
// At first, select a specific LP.
rc = Evo.LPI.SelectLP(idLPI, i);
Debug.Assert(rc == 0);
// Get text string.
rc = Evo.LPI.GetStr(idLPI, strBuf);
Debug.Assert(rc == 0);
Console.WriteLine("\n{0}", strBuf.ToString());
// Get character confidences.
len = (uint)bufCC.Length;
rc = Evo.LPI.GetCharConf(idLPI, bufCC, ref len);
Debug.Assert(rc == 0);
Console.Write(" --> Char Confidences: ");
for (uint j = 0; j < len; j++)
Console.Write("{0}% ", bufCC[j]);
Console.WriteLine();
// Get the bounding box.
rc = Evo.LPI.GetPos(idLPI, out bbox);
Debug.Assert(rc == 0);
Console.WriteLine(" --> Position: {0}, {1}, {2}, {3}", bbox.x, bbox.y, bbox.width, bbox.height);
// Get the type and its confidence.
rc = Evo.LPI.GetType(idLPI, out type, out confidence);
Debug.Assert(rc == 0);
Console.WriteLine(" --> Type: {0} ({1}%)", type, confidence);
}
// Must release the LPI context.
Evo.Func.FreeObj(ref idLPI);
Debug.Assert(idLPI < 0);
}
// If required, save the rectified image.
rc = Evo.Picture.SaveInJPEG(idPic, "rectified_image.jpg");
Debug.Assert(rc == 0);
// 8. Release the rectified image.
Evo.Func.FreeObj(ref idPic);
Debug.Assert(idPic < 0);
// 9. Deinitialize the engine.
Evo.SSEngine.Deinit(idSSE);
// 10. Destroy the engine.
Evo.Func.FreeObj(ref idSSE);
Debug.Assert(idSSE < 0);
// 11. Destory the camera model.
Evo.Func.FreeObj(ref idFisheyeModel);
Debug.Assert(idFisheyeModel < 0);
}
}
}