public ulong Get(string pictureFileName) { using (var baseImage = DalContext.FindPictureByFileName(pictureFileName)) using (var grayScale = TransformImages.GrayScale(baseImage, 8, 8)) { var grayScaleColorMatrix = ColorsMatrix.Get(grayScale); var threshold = OtcuBinarization.CalcThreshold(grayScaleColorMatrix); return(Instance.Get(grayScaleColorMatrix, threshold)); } }
public string ByImage(string pictureFileName) { using (var baseImage = DalContext.FindPictureByFileName(pictureFileName)) using (var grayScale = TransformImages.GrayScale(baseImage, 128, 128)) { var grayScaleColorMatrix = ColorsMatrix.Get(grayScale); var threshold = OtcuBinarization.CalcThreshold(grayScaleColorMatrix); var result = Instance.ByImage(grayScaleColorMatrix, threshold); return(JsonConvert.SerializeObject(result)); } }