Пример #1
0
        /// <summary>
        /// Returns system ID (hardware ID)
        /// </summary>
        /// <returns>system ID string</returns>
        static public string GetSystemID()
        {
            StringBuilder sysID = new StringBuilder(50);

            DTKLPR4.GetSystemID(sysID, 50);
            return(sysID.ToString());
        }
Пример #2
0
        public string GetXOption(string optionName)
        {
            StringBuilder builder = new StringBuilder(255);

            DTKLPR4.LPRParams_GetXOption(this.hParmas, optionName, builder, 255);
            return(builder.ToString());
        }
Пример #3
0
        public static string GetLibraryVersion()
        {
            int           required_size = DTKLPR4.GetLibraryVersion(null, 0);
            StringBuilder builder       = new StringBuilder(required_size);

            DTKLPR4.GetLibraryVersion(builder, required_size);
            return(builder.ToString());
        }
Пример #4
0
        static public string GetActivationLink(string licenseKey, string comments)
        {
            StringBuilder actLink = new StringBuilder(255);

            if (DTKLPR4.GetActivationLink(licenseKey, comments, actLink, 255) == 0)
            {
                return(actLink.ToString());
            }
            return("");
        }
Пример #5
0
        /// <summary>
        /// Constructor of LPREngine instance
        /// </summary>
        public VideoCapture(FrameCaptured frameCapturedCallback, CaptureError captureErrorCallback, object customObject)
        {
            this.frameCapturedCallback        = frameCapturedCallback;
            this.captureErrorCallback         = captureErrorCallback;
            this.navive_frameCapturedCallback = new DTKLPR4.FrameCapturedNative(OnFrameCapturedNative);
            this.navive_captureErrorCallback  = new DTKLPR4.CaptureErrorNative(OnCaptureErrorNative);
            this.customObject = customObject;

            this.hVideoCapture = DTKLPR4.VideoCapture_Create(
                Marshal.GetFunctionPointerForDelegate(navive_frameCapturedCallback),
                Marshal.GetFunctionPointerForDelegate(navive_captureErrorCallback),
                IntPtr.Zero);
        }
Пример #6
0
        /// <summary>
        /// eads license plates from image buffer, the engine must be initialized for still image processing (bVideo parameters must be set to 'False' in LPR engine constructor).
        /// </summary>
        /// <param name="pBuffer">pointer to memory buffer</param>
        /// <param name="width">image width</param>
        /// <param name="height">image height</param>
        /// <param name="stride">the size of a single image row in bytes</param>
        /// <param name="pixelFormat">1 - grayscale, 2 - RGB24, 4 - YUV420</param>
        /// <returns></returns>
        public List <LicensePlate> ReadFromImageBuffer(IntPtr pBuffer, int width, int height, int stride, PIXFMT pixelFormat)
        {
            List <LicensePlate> res = new List <LicensePlate>();
            IntPtr hResult          = DTKLPR4.LPREngine_ReadFromImageBuffer(this.hEngine, pBuffer, width, height, stride, pixelFormat);
            int    count            = DTKLPR4.LPRResult_GetPlatesCount(hResult);

            for (int i = 0; i < count; i++)
            {
                IntPtr hPlate = DTKLPR4.LPRResult_GetPlate(hResult, i);
                res.Add(new LicensePlate(hPlate));
            }
            return(res);
        }
Пример #7
0
        /// <summary>
        /// Reads license plates from image file, the engine must be initialized for still image processing (bVideo parameters must be set to 'False' in LPR engine constructor).
        /// </summary>
        /// <param name="fileName">full path to image file (BMP, JPG, PNG)</param>
        /// <returns>List of LicensePlate objects</returns>
        public List <LicensePlate> ReadFromFile(string fileName)
        {
            List <LicensePlate> res = new List <LicensePlate>();
            IntPtr hResult          = DTKLPR4.LPREngine_ReadFromFile(this.hEngine, fileName);
            int    count            = DTKLPR4.LPRResult_GetPlatesCount(hResult);

            for (int i = 0; i < count; i++)
            {
                IntPtr hPlate = DTKLPR4.LPRResult_GetPlate(hResult, i);
                res.Add(new LicensePlate(hPlate));
            }
            DTKLPR4.LPRResult_Destroy(hResult);
            return(res);
        }
Пример #8
0
        public static List <string> GetSupportedCountries()
        {
            int           required_size = DTKLPR4.GetSupportedCountries(null, 0);
            StringBuilder builder       = new StringBuilder(required_size);

            DTKLPR4.GetSupportedCountries(builder, required_size);
            List <string> res = new List <string>();

            foreach (string item in builder.ToString().Split(';'))
            {
                res.Add(item);
            }
            return(res);
        }
Пример #9
0
        /// <summary>
        /// Releases resources of LPREngine instance
        /// </summary>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing == true)
            {
                //someone want the deterministic release of all resources
                //Let us release all the managed resources
                //ReleaseManagedResources();
            }
            else
            {
                // Do nothing, no one asked a dispose, the object went out of
                // scope and finalized is called so lets next round of GC
                // release these resources
            }

            // Release the unmanaged resource in any case as they will not be
            // released by GC
            if (hPlate != IntPtr.Zero)
            {
                DTKLPR4.LicensePlate_Destroy(this.hPlate);
                hPlate = IntPtr.Zero;
            }
        }
Пример #10
0
        /// <summary>
        /// Gets activated license information
        /// </summary>
        /// <param name="licenseKey">license key</param>
        /// <param name="comments">comments</param>
        /// <param name="channels">maximum number of channels</param>
        /// <param name="expirationDate">expiration date (for time limited licenses)</param>
        /// <returns>returns 0 on success, an error code otherwise</returns>
        static public void GetActivatedLicenseInfo(out string licenseKey, out string comments, out int channels, out DateTime expirationDate)
        {
            StringBuilder licKey = new StringBuilder(50);
            StringBuilder comm   = new StringBuilder(255);
            ulong         expDate_time_t;

            DTKLPR4.GetActivatedLicenseInfo(licKey, 50, comm, 255, out channels, out expDate_time_t);

            if (expDate_time_t != 0)
            {
                expirationDate = new DateTime(1970, 1, 1).ToLocalTime().AddSeconds(expDate_time_t);
                if (expirationDate.Year < 2000)
                {
                    expirationDate = DateTime.MaxValue;
                }
            }
            else
            {
                expirationDate = DateTime.MaxValue;
            }
            licenseKey = licKey.ToString();
            comments   = comm.ToString();
        }
Пример #11
0
 /// <summary>
 /// Removes point for specific recognition zone.
 /// </summary>
 /// <param name="zoneIndex">zone inxed</param>
 /// <param name="pointIndex">point index</param>
 /// <returns></returns>
 public int RemoveZonePoint(int zoneIndex, int pointIndex)
 {
     return(DTKLPR4.LPRParams_RemoveZonePoint(this.hParmas, zoneIndex, pointIndex));
 }
Пример #12
0
 /// <summary>
 /// Adds new point for specific recognition zone.
 /// </summary>
 /// <param name="zoneIndex">zone index</param>
 /// <param name="x">x-coordinate</param>
 /// <param name="y">y-coordinate</param>
 /// <returns></returns>
 public int AddZonePoint(int zoneIndex, int x, int y)
 {
     return(DTKLPR4.LPRParams_AddZonePoint(this.hParmas, zoneIndex, x, y));
 }
Пример #13
0
 /// <summary>
 /// Gets point coordinates for specific recognition zone.
 /// </summary>
 /// <param name="zoneIndex">zone index</param>
 /// <param name="pointIndex">point index</param>
 /// <param name="x">x-coordinate (out parameter)</param>
 /// <param name="y">y-coordinate (out parameter)</param>
 public void GetZonePoint(int zoneIndex, int pointIndex, out int x, out int y)
 {
     DTKLPR4.LPRParams_GetZonePoint(this.hParmas, zoneIndex, pointIndex, out x, out y);
 }
Пример #14
0
 /// <summary>
 /// Gets number of points for specific recogntion zone.
 /// </summary>
 /// <param name="zoneIndex">index of zone</param>
 /// <returns>number of points</returns>
 public int GetZonePointsCount(int zoneIndex)
 {
     return(DTKLPR4.LPRParams_GetZonePointsCount(this.hParmas, zoneIndex));
 }
Пример #15
0
 /// <summary>
 /// Removes recognition zone by index
 /// </summary>
 /// <param name="zoneIndex">zone index</param>
 public void RemoveZone(int zoneIndex)
 {
     DTKLPR4.LPRParams_RemoveZone(this.hParmas, zoneIndex);
 }
Пример #16
0
 /// <summary>
 /// Adds new recognition zone.
 /// </summary>
 /// <returns>index of added zone</returns>
 public int AddZone()
 {
     return(DTKLPR4.LPRParams_AddZone(this.hParmas));
 }
Пример #17
0
 /// <summary>
 /// Creates new instance of LPRParams.
 /// </summary>
 public LPRParams()
 {
     this.hParmas = DTKLPR4.LPRParams_Create();
 }
Пример #18
0
 public int StartCaptureFromFile(string fileName, int repeat_count)
 {
     return(DTKLPR4.VideoCapture_StartCaptureFromFile(this.hVideoCapture, fileName, repeat_count));
 }
Пример #19
0
 public int StartCaptureFromIPCamera(string ipCameraURL)
 {
     return(DTKLPR4.VideoCapture_StartCaptureFromIPCamera(this.hVideoCapture, ipCameraURL));
 }
Пример #20
0
 /// <summary>
 /// Activates license key online
 /// </summary>
 /// <param name="licenseKey">license key</param>
 /// <param name="comments">comments string (optional)</param>
 /// <returns>returns 0 on success, an error code otherwise</returns>
 static public int ActivateLicenseOnline(string licenseKey, string comments)
 {
     return(DTKLPR4.ActivateLicenseOnline(licenseKey, comments));
 }
Пример #21
0
 public int StartCaptureFromDevice(int deviceIndex, int captureWidth, int captureHeight)
 {
     return(DTKLPR4.VideoCapture_StartCaptureFromDevice(this.hVideoCapture, deviceIndex, captureWidth, captureHeight));
 }
Пример #22
0
 public void SetXOption(string optionName, string val)
 {
     DTKLPR4.LPRParams_SetXOption(this.hParmas, optionName, val);
 }
Пример #23
0
 /// <summary>
 /// Gets number of recognition zones.
 /// </summary>
 /// <returns>number of recognition zones</returns>
 public int GetZonesCount()
 {
     return(DTKLPR4.LPRParams_GetZonesCount(this.hParmas));
 }
Пример #24
0
 /// <summary>
 /// Puts the video frame to processing queue, the engine must be initialized for video processing (bVideo parameters must be set to 'True' in LPR engine constructor).
 /// </summary>
 /// <param name="pBuffer">pointer to memory buffer</param>
 /// <param name="width">image width</param>
 /// <param name="height">image height</param>
 /// <param name="stride">the size of a single image row in bytes</param>
 /// <param name="pixelFormat">1 - grayscale, 2 - RGB24, 4 - YUV420</param>
 /// <param name="frameID">custom parameter which can be used to identify video frame</param>
 /// <returns></returns>
 public int PutFrameImageBuffer(IntPtr pBuffer, int width, int height, int stride, PIXFMT pixelFormat, long timestamp, long customData)
 {
     return(DTKLPR4.LPREngine_PutFrameImageBuffer(this.hEngine, pBuffer, width, height, stride, pixelFormat, timestamp, customData));
 }
Пример #25
0
 public int StopCapture()
 {
     return(DTKLPR4.VideoCapture_StopCapture(this.hVideoCapture));
 }
Пример #26
0
 /// <summary>
 /// Constructor of LPREngine instance
 /// </summary>
 public LPREngine(LPRParams parameters, bool bVideo, LicensePlateDetected callback)
 {
     this.callback        = callback;
     this.navive_callback = new DTKLPR4.LicensePlateDetectedNative(OnLicensePlateDetectedNative);
     this.hEngine         = DTKLPR4.LPREngine_Create(parameters.hParmas, bVideo, Marshal.GetFunctionPointerForDelegate(navive_callback));
 }
Пример #27
0
 /// <summary>
 /// Activates license using activation code
 /// </summary>
 /// <param name="activationCode">activation code</param>
 /// <returns>returns 0 on success, an error code otherwise</returns>
 static public int ActivateLicenseOffline(string activationCode)
 {
     return(DTKLPR4.ActivateLicenseOffline(activationCode));
 }