Esempio n. 1
0
 public void WorkAction(string pictureFileName)
 {
     using (var baseImage = DalContext.FindPictureByFileName(pictureFileName))
     {
         Instance.Work(baseImage, data => { });
     }
 }
Esempio n. 2
0
 public void Get(string pictureFileName)
 {
     using (var baseImage = DalContext.FindPictureByFileName(pictureFileName))
     {
         Instance.Get(baseImage);
     }
 }
Esempio n. 3
0
 public void WorkFunctor(string pictureFileName)
 {
     using (var baseImage = DalContext.FindPictureByFileName(pictureFileName))
     {
         var result = Instance.Work(baseImage, data => 42.0);
         Assert.AreEqual(42, result);
     }
 }
Esempio n. 4
0
 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);
         }
 }
Esempio n. 5
0
 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);
         }
 }
Esempio n. 6
0
 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));
         }
 }
Esempio n. 7
0
 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));
         }
 }
Esempio n. 8
0
 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);
         }
 }
Esempio n. 9
0
 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));
         }
 }
Esempio n. 10
0
 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");
         }
 }
Esempio n. 11
0
 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));
 }