示例#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);
         }
 }
示例#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));
         }
 }
示例#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));
         }
 }
示例#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);
         }
 }
示例#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));
         }
 }