Beispiel #1
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);
         }
 }
Beispiel #2
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));
         }
 }
Beispiel #3
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));
         }
 }
Beispiel #4
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);
         }
 }
Beispiel #5
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));
         }
 }