public void LicensePlateCaptured(LicensePlateInfo licensePlateInfo) { _licensePlateCheckService.Check(licensePlateInfo.LicensePlateNumber, result => { if (result.IsSuspecious) { var alerm = new SuspeciousCarAlermInfo() { CapturedLicenseInfo = licensePlateInfo, ReportedCarInfo = result }; foreach (var l in _suspeciousLicensePlateObserver) { try { l.Notify(alerm); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } } }); }
public void LicensePlateCaptured(LicensePlateInfo licensePlateInfo) { _licensePlateCheckService.Check(licensePlateInfo.LicensePlateNumber, result=> { if (result.IsSuspecious) { var alerm = new SuspeciousCarAlermInfo() { CapturedLicenseInfo = licensePlateInfo, ReportedCarInfo = result }; foreach (var l in _suspeciousLicensePlateObserver) { try { l.Notify(alerm); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } } }); }
public void AddLicensePlateInfo(LicensePlateInfo licensePlateInfo) { var img = licensePlateInfo.LoadImage(); var ratio = (float)img.Height / img.Width; var thumbNail = img.GetThumbnailImage(64, (int)(64 * ratio), null, IntPtr.Zero); img.Dispose(); var lpin = new LicenseplateInfoWithThumbnail() { Thumbnail = thumbNail, LicenseplateNumber = licensePlateInfo.LicensePlateNumber, CaptureTime = licensePlateInfo.CaptureTime, Info = licensePlateInfo }; if (InvokeRequired) { Action action = () => _licensePlates.Add(lpin); BeginInvoke(action); return; } _licensePlates.Add(lpin); }
private LicensePlateInfo ParsePath(string fullPath) { try { var fileName = System.IO.Path.GetFileNameWithoutExtension(fullPath); var strings = fileName.Split(new char[] { '-' }, System.StringSplitOptions.RemoveEmptyEntries); if (strings.Length < Configuration.LeastSectionCount) { throw new FormatException("file naming format incorrect"); } var licensePlateInfo = new LicensePlateInfo(); licensePlateInfo.CaptureTime = new FileInfo(fullPath).CreationTime; licensePlateInfo.ImageData = File.ReadAllBytes(fullPath); var number = strings[Configuration.LicensePlateSectionIndex]; licensePlateInfo.LicensePlateNumber = number; ParseLicensePlateRect(strings, licensePlateInfo); licensePlateInfo.LicensePlateColor = ParseColor(strings); return(licensePlateInfo); } catch (System.Exception ex) { throw new FormatException("file naming format incorrect", ex); } }
private string BuildAbsoluteImagePath(LicensePlateInfo licensePlateInfo) { var relative = GetRelativeImagePath(licensePlateInfo); var absolute = System.IO.Path.Combine(_outputDirectory, relative); return absolute; }
private string BuildAbsoluteImagePath(LicensePlateInfo licensePlateInfo) { var relative = GetRelativeImagePath(licensePlateInfo); var absolute = System.IO.Path.Combine(_outputDirectory, relative); return(absolute); }
private string GetRelativeImagePath(LicensePlateInfo licensePlateInfo) { var relativePath = string.Format(@"{0}\{1:d4}{2:d2}{3:d2}\{4}.jpg", LicensePlatesDirectoryName, licensePlateInfo.CaptureTime.Year, licensePlateInfo.CaptureTime.Month, licensePlateInfo.CaptureTime.Day, licensePlateInfo.Guid); return relativePath; }
private void ParseLicensePlateRect(string[] strings, LicensePlateInfo licensePlateInfo) { if (Configuration.LicensePlatePositionIndex > -1) { var positionString = strings[Configuration.LicensePlatePositionIndex]; var poisitionStrings = positionString.Split(new[] { Configuration.LicensePlateCoordinateSeparator }, StringSplitOptions.RemoveEmptyEntries); var position = ParseRectangle(poisitionStrings); licensePlateInfo.LicensePlateRect = position; } }
private string GetRelativeImagePath(LicensePlateInfo licensePlateInfo) { var relativePath = string.Format(@"{0}\{1:d4}{2:d2}{3:d2}\{4}.jpg", LicensePlatesDirectoryName, licensePlateInfo.CaptureTime.Year, licensePlateInfo.CaptureTime.Month, licensePlateInfo.CaptureTime.Day, licensePlateInfo.Guid); return(relativePath); }
void Run(object state) { while (true) { System.Threading.Thread.Sleep(3000); var licensePlate = new LicensePlateInfo(); licensePlate.CapturedFrom = 1; licensePlate.CaptureTime = DateTime.Now; licensePlate.LicensePlateNumber = "川D12345"; _publisher.PublishLicensePlate(licensePlate); } }
void Run(object state) { while (true) { System.Threading.Thread.Sleep(3000); var licensePlate = new LicensePlateInfo(); licensePlate.CapturedFrom = 1; licensePlate.CaptureTime = DateTime.Now; licensePlate.LicensePlateNumber = "川D12345"; _publisher.PublishLicensePlate(licensePlate); } }
public void Save(LicensePlateInfo licensePlateInfo) { var dto = _mapper.ToDto(licensePlateInfo); var absolutePath = System.IO.Path.Combine(_outputDirectory, dto.LicensePlateImageFileRelativePath); var dir = System.IO.Directory.GetParent(absolutePath).ToString(); if (!System.IO.Directory.Exists(dir)) { System.IO.Directory.CreateDirectory(dir); } System.IO.File.WriteAllBytes(absolutePath, licensePlateInfo.ImageData); licensePlateInfo.LicensePlateImageFileAbsolutePath = absolutePath; _dataProvider.Save(dto); }
public void Save(LicensePlateInfo licensePlateInfo) { var dto = _mapper.ToDto(licensePlateInfo); var absolutePath = System.IO.Path.Combine(_outputDirectory, dto.LicensePlateImageFileRelativePath); var dir = System.IO.Directory.GetParent(absolutePath).ToString(); if (!System.IO.Directory.Exists(dir)) { System.IO.Directory.CreateDirectory(dir); } System.IO.File.WriteAllBytes(absolutePath, licensePlateInfo.ImageData); licensePlateInfo.LicensePlateImageFileAbsolutePath = absolutePath; _dataProvider.Save(dto); }
private LicensePlateInfo ParsePath(string fullPath) { try { var fileName = System.IO.Path.GetFileNameWithoutExtension(fullPath); var strings = fileName.Split(new char[] { '-' }, System.StringSplitOptions.RemoveEmptyEntries); if (strings.Length < Configuration.LeastSectionCount) throw new FormatException("file naming format incorrect"); var licensePlateInfo = new LicensePlateInfo(); licensePlateInfo.CaptureTime = new FileInfo(fullPath).CreationTime; licensePlateInfo.ImageData = File.ReadAllBytes(fullPath); var number = strings[Configuration.LicensePlateSectionIndex]; licensePlateInfo.LicensePlateNumber = number; ParseLicensePlateRect(strings, licensePlateInfo); licensePlateInfo.LicensePlateColor = ParseColor(strings); return licensePlateInfo; } catch (System.Exception ex) { throw new FormatException("file naming format incorrect", ex); } }
public void PublishLicensePlate(LicensePlateInfo licensePlateInfo) { _observers.ForEach(o => o.LicensePlateCaptured(licensePlateInfo)); }
public void LicensePlateCaptured(LicensePlateInfo licensePlateInfo) { //if (InvokeRequired) //{ // Action<LicensePlateInfo> action = LicensePlateCaptured; // this.Invoke(action, licensePlateInfo); // return; //} //var camInfo = _configurationManager.GetCameraById(licensePlateInfo.CapturedFrom); //var cameraName = "未知摄像头"; //if (camInfo != null) //{ // cameraName = camInfo.Name ?? "未知摄像头"; //} //if (_licensePlates.Count > Properties.Settings.Default.MaxmumLicenseplates) //{ // _licensePlates.RemoveAt(0); //} }
private void ParseLicensePlateRect(string[] strings, LicensePlateInfo licensePlateInfo) { if (Configuration.LicensePlatePositionIndex > -1) { var positionString = strings[Configuration.LicensePlatePositionIndex]; var poisitionStrings = positionString.Split(new[] { Configuration.LicensePlateCoordinateSeparator }, StringSplitOptions.RemoveEmptyEntries); var position = ParseRectangle(poisitionStrings); licensePlateInfo.LicensePlateRect = position; } }
public void AddLicensePlateInfo(LicensePlateInfo licensePlateInfo) { var img = licensePlateInfo.LoadImage(); var ratio = (float)img.Height / img.Width; var thumbNail = img.GetThumbnailImage(64, (int)(64 * ratio), null, IntPtr.Zero); img.Dispose(); var lpin = new LicenseplateInfoWithThumbnail() { Thumbnail = thumbNail, LicenseplateNumber = licensePlateInfo.LicensePlateNumber, CaptureTime = licensePlateInfo.CaptureTime, Info = licensePlateInfo }; if (InvokeRequired) { Action action = () => _licensePlates.Add(lpin); BeginInvoke(action); return; } _licensePlates.Add(lpin); }
public DtoLicensePlateInfo ToDto(LicensePlateInfo licensePlateInfo) { var dto = AutoMapper.Mapper.Map <LicensePlateInfo, DtoLicensePlateInfo>(licensePlateInfo); return(dto); }
public void PublishLicensePlate(LicensePlateInfo licensePlateInfo) { _observers.ForEach(o => o.LicensePlateCaptured(licensePlateInfo)); }
public void LicensePlateCaptured(LicensePlateInfo licensePlateInfo) { Save(licensePlateInfo); }
public void LicensePlateCaptured(LicensePlateInfo licensePlateInfo) { Save(licensePlateInfo); }
public void AddLicensePlate(LicensePlateInfo licensePlateInfo) { _licensePlates.Add(licensePlateInfo); }
public DtoLicensePlateInfo ToDto(LicensePlateInfo licensePlateInfo) { var dto = AutoMapper.Mapper.Map<LicensePlateInfo, DtoLicensePlateInfo>(licensePlateInfo); return dto; }