private void ParseImage(byte[] data, PictureName name, PictureType type) { Image img = Image.FromStream(new MemoryStream(data)); if (!_images.ContainsKey(name)) { _images.Add(name, new Dictionary<PictureType, Image>()); } if (_images[name].ContainsKey(type)) { _images[name][type] = img; } else { _images[name].Add(type, img); } }
private void ParseImage(byte[] data, PictureName name, PictureType type) { Image img = Image.FromStream(new MemoryStream(data)); if (!_images.ContainsKey(name)) { _images.Add(name, new Dictionary <PictureType, Image>()); } if (_images[name].ContainsKey(type)) { _images[name][type] = img; } else { _images[name].Add(type, img); } }
protected void Page_Load(object sender, EventArgs e) { PictureName.Focus(); }
public LanguagePicture(PictureName a) { Picture = a; }
public ImageInfo(PictureName name) { _name = name; }
public Image GetImage(PictureName name, PictureType type) { var lang = RConfig.Instance.Language; return(!_languages.ContainsKey(lang) ? null : _languages[lang].GetImage(name, type)); }
public Image GetImage(PictureName name, PictureType type) { return !_images.ContainsKey(name) ? null : (!_images[name].ContainsKey(type) ? null : _images[name][type]); }
public ImageInfo this[PictureName name] { get { return(_images.ContainsKey(name) ? _images[name] : null); } }
public Image GetImage(PictureName name, PictureType type) { return(!_images.ContainsKey(name) ? null : (!_images[name].ContainsKey(type) ? null : _images[name][type])); }
/// <summary> /// 获取不同倍率图的路径 /// </summary> /// <param name="width">图片宽度</param> /// <returns></returns> public string GetRatePicName(int width) { return(PictureName.Insert(PictureName.LastIndexOf("."), "-w" + width)); }
public Image GetImage(PictureName name, PictureType type) { var lang = RConfig.Instance.Language; return !_languages.ContainsKey(lang) ? null : _languages[lang].GetImage(name, type); }
public ImageInfo this[PictureName name] { get { return _images.ContainsKey(name) ? _images[name] : null; } }
public async Task SendFaceCompareName(string name) { //Path dependent string imageFilePath1 = "B3Image/"; imageFilePath1 += name; string contentString1 = await FaceCompare(imageFilePath1, 0); // Display the JSON response. Console.WriteLine("Response1:\n"); Console.WriteLine(contentString1); string[] words1 = contentString1.Split('"'); string MostMatchName = ""; double Match = 0; string PicFolder = "ImageDatabase/"; string base64string = ""; foreach (string PictureName in Directory.GetFiles(PicFolder)) { Console.WriteLine(PictureName); if ((!PictureName.EndsWith(".jpg")) && (!PictureName.EndsWith(".jpeg")) && (!PictureName.EndsWith(".png"))) { Console.WriteLine("!!!!!!!" + PictureName); continue; } string contentString2 = await FaceCompare(PictureName, 0); Console.WriteLine("Response2:\n"); Console.WriteLine(contentString2); string[] words2 = contentString2.Split('"'); var client2 = new FaceServiceClient(subscriptionKey, enpointUrl); var verifyResult = await client2.VerifyAsync(new Guid(words1[3]), new Guid(words2[3])); Console.WriteLine("The verification result is:" + $"\n Same person:{verifyResult.IsIdentical}" + $"\n Confidence:{verifyResult.Confidence}"); if (verifyResult.Confidence > Match) { MostMatchName = ""; MostMatchName += PictureName; Match = verifyResult.Confidence; byte[] byteData = null; byteData = GetImageAsByteArray(PictureName); base64string = ""; base64string += Convert.ToBase64String(byteData); } } string message = $"After searching the Database, the most matching picture is " + MostMatchName.Split('/')[1] + "<br>"; if (Match > 0.5) { message += "They are the same person <br>"; message += $"Confidence:{Match}\n"; } else { message += "They are different person <br>"; message += $"Confidence:{Match}\n"; } Console.WriteLine(message); await Clients.All.SendAsync("ReceiveFaceCompareMessage", message, MostMatchName, base64string); }