public void WorkAction(string pictureFileName) { using (var baseImage = DalContext.FindPictureByFileName(pictureFileName)) { Instance.Work(baseImage, data => { }); } }
public void Get(string pictureFileName) { using (var baseImage = DalContext.FindPictureByFileName(pictureFileName)) { Instance.Get(baseImage); } }
public void WorkFunctor(string pictureFileName) { using (var baseImage = DalContext.FindPictureByFileName(pictureFileName)) { var result = Instance.Work(baseImage, data => 42.0); Assert.AreEqual(42, result); } }
public void Transform(string pictureFileName) { using (var baseImage = DalContext.FindPictureByFileName(pictureFileName)) using (var grayScale = TransformImages.GrayScale(baseImage, baseImage.Width, baseImage.Height)) { var grayScaleColorMatrix = ColorsMatrix.Get(grayScale); Instance.Transform(grayScaleColorMatrix); } }
public void Set(string pictureFileName) { using (var baseImage = DalContext.FindPictureByFileName(pictureFileName)) using (var resultImage = new Bitmap(baseImage.Width, baseImage.Height)) { var colorMatrix = Instance.Get(baseImage); Instance.Set(resultImage, colorMatrix); } }
public int CalcThreshold(string pictureFileName) { using (var baseImage = DalContext.FindPictureByFileName(pictureFileName)) using (var grayScale = TransformImages.GrayScale(baseImage, baseImage.Width, baseImage.Height)) { var grayScaleColorMatrix = ColorsMatrix.Get(grayScale); return(Instance.CalcThreshold(grayScaleColorMatrix)); } }
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 void Binarization(string pictureFileName) { using (var baseImage = DalContext.FindPictureByFileName(pictureFileName)) using (var grayScale = TransformImages.GrayScale(baseImage, baseImage.Width, baseImage.Height)) { var grayScaleColorMatrix = ColorsMatrix.Get(grayScale); var threshold = Instance.CalcThreshold(grayScaleColorMatrix); Instance.Binarization(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)); } }
public void GrayScale(string pictureFileName) { using (var baseImage = DalContext.FindPictureByFileName(pictureFileName)) using (var grayScaleImage = Instance.GrayScale(baseImage, 128, 128)) { this.IsNotNull(grayScaleImage, "variable [resizeImage] is null") .Verify(() => grayScaleImage.GetType() == typeof(Bitmap), "type variable [grayScaleImage] is not typeof(Bitmap)") .Verify(() => grayScaleImage.Width == 128, $"variable [grayScaleImage] is not width 128px") .Verify(() => grayScaleImage.Height == 128, $"variable [grayScaleImage] is not height 128px"); } }
protected Color[,] GetColorMatrix(string pictureFileName, int newWidth, int newHeight) { using (var baseImage = DalContext.FindPictureByFileName(pictureFileName)) using (var grayScale = TransformImages.GrayScale(baseImage, newWidth, newHeight)) return(ColorsMatrix.Get(grayScale)); }