/// <summary> /// 图片特征 /// </summary> /// <param name="rectVal"></param> /// <returns></returns> public string 图片特征(string rectVal) { var img = Img(); var rect = Helper.GetRectangle(rectVal); using (var bmp = img.Clone(rect, img.PixelFormat)) { return(HashNormalHelper.Hash(bmp)); } }
/// <summary> /// 读取特征存储 /// </summary> /// <param name="srcBmp"></param> /// <param name="rect"></param> /// <returns></returns> public void AddFeature(Bitmap srcBmp, Rectangle rect) { using (System.Drawing.Bitmap bmp = srcBmp.Clone(rect, srcBmp.PixelFormat)) { Features.Add(new FeatureItem() { Name = $@"图片特征{DateTime.Now.ToFileTime()}", Feature = HashNormalHelper.Hash(bmp), Rect = rect }); } }