Added oneshot apps
@@ -0,0 +1,13 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
/contentModel.xml
|
||||
/projectSettingsUpdater.xml
|
||||
/modules.xml
|
||||
/.idea.Implementation.iml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||
</project>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitToolBoxProjectSettings">
|
||||
<option name="commitMessageIssueKeyValidationOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
<option name="commitMessageValidationEnabledOverride">
|
||||
<BoolValueOverride>
|
||||
<option name="enabled" value="true" />
|
||||
</BoolValueOverride>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DiscordProjectSettings">
|
||||
<option name="show" value="ASK" />
|
||||
<option name="description" value="" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -45,6 +45,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReportGeneration.Generators
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReportGeneration.Abstract", "..\ReportGeneration\ReportGeneration.Abstract\ReportGeneration.Abstract.csproj", "{80BF15A5-78EB-4B87-8C1B-7F90D6D8BC74}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ocr.OneShot.Resampling", "Ocr.OneShot.Resampling\Ocr.OneShot.Resampling.csproj", "{4149E8A8-BD3C-4581-BDDD-FA70A58FBE37}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ocr.OneShot.Postprocessing", "Ocr.OneShot.Postprocessing\Ocr.OneShot.Postprocessing.csproj", "{40EA7F8E-BF46-410F-BA2B-CB05B80DCDBB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -115,6 +119,14 @@ Global
|
||||
{80BF15A5-78EB-4B87-8C1B-7F90D6D8BC74}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{80BF15A5-78EB-4B87-8C1B-7F90D6D8BC74}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{80BF15A5-78EB-4B87-8C1B-7F90D6D8BC74}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4149E8A8-BD3C-4581-BDDD-FA70A58FBE37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4149E8A8-BD3C-4581-BDDD-FA70A58FBE37}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4149E8A8-BD3C-4581-BDDD-FA70A58FBE37}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4149E8A8-BD3C-4581-BDDD-FA70A58FBE37}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{40EA7F8E-BF46-410F-BA2B-CB05B80DCDBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{40EA7F8E-BF46-410F-BA2B-CB05B80DCDBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{40EA7F8E-BF46-410F-BA2B-CB05B80DCDBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{40EA7F8E-BF46-410F-BA2B-CB05B80DCDBB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Ocr\Ocr.Tesseract.Screenshots\Ocr.Tesseract.Screenshots.csproj" />
|
||||
<ProjectReference Include="..\..\Ocr\Ocr.Tesseract\Ocr.Tesseract.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,51 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
using System.Text.RegularExpressions;
|
||||
using ImageMagick;
|
||||
using Ocr.Tesseract;
|
||||
using Ocr.Tesseract.Models;
|
||||
using Ocr.Tesseract.Screenshots;
|
||||
using Ocr.Tesseract.Screenshots.Configuration;
|
||||
using Ocr.Tesseract.Screenshots.Threshold;
|
||||
using Process.Abstract.Configuration;
|
||||
using Process.Interface;
|
||||
|
||||
|
||||
Console.WriteLine("Hello, World!");
|
||||
|
||||
IProcessorChain<MagickImage, ScanResult> MakeProcessor()
|
||||
{
|
||||
var wordRegex = new Regex(
|
||||
@"[\w'\-]{2,}",
|
||||
RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnoreCase
|
||||
);
|
||||
|
||||
var tesseractConfig = new TesseractScreenshotConfiguration
|
||||
{
|
||||
DataPath = "tessdata",
|
||||
Languages = new[] { "eng", "deu" }
|
||||
};
|
||||
|
||||
var preprocessing = new ProcessorChainConfiguration<MagickImage, MagickImage>()
|
||||
.Use(new CloneImageProcessor())
|
||||
.Use(new ResizeProcessor(FilterType.Lanczos2Sharp, PixelInterpolateMethod.Mesh))
|
||||
.Use(new NormalizeProcessor())
|
||||
.Use(new ThresholdAdaptiveProcessor(15, 15))
|
||||
.Use(new AddBorderProcessor(10))
|
||||
.Use(new BinarizeProcessor())
|
||||
.Complete(new NegateCloneProcessor());
|
||||
|
||||
var postprocessing = new ProcessorChainConfiguration<ScanResult, ScanResult>()
|
||||
.Use(new ConfidenceFilter(50))
|
||||
// todo insert processing events and write to json files
|
||||
.Use(new ToLowerProcessor())
|
||||
.Use(new DuplicateFilter())
|
||||
.Complete(new RegexFilter(wordRegex));
|
||||
|
||||
var scan = new TesseractProcessor(tesseractConfig);
|
||||
|
||||
return new ProcessorChainConfiguration<MagickImage, ScanResult>()
|
||||
.Use(preprocessing)
|
||||
.Use(scan)
|
||||
.Complete(postprocessing);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="13.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Ocr\Ocr.Tesseract\Ocr.Tesseract.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,29 @@
|
||||
using ImageMagick;
|
||||
using Ocr.Tesseract.Extensions;
|
||||
|
||||
const float factor = 4f;
|
||||
const string downscaled = "downscaled.png";
|
||||
|
||||
using (var image = new MagickImage(args.Single()))
|
||||
{
|
||||
image.ResizeImage(0.8f, FilterType.Catrom, PixelInterpolateMethod.Undefined);
|
||||
image.Write(downscaled);
|
||||
}
|
||||
|
||||
using (var image = new MagickImage(downscaled))
|
||||
{
|
||||
image.ResizeImage(factor, FilterType.Lanczos, PixelInterpolateMethod.Catrom);
|
||||
image.Write("Lanczos.png");
|
||||
}
|
||||
|
||||
using (var image = new MagickImage(downscaled))
|
||||
{
|
||||
image.ResizeImage(factor, FilterType.Point, PixelInterpolateMethod.Integer);
|
||||
image.Write("Nearest.png");
|
||||
}
|
||||
|
||||
using (var image = new MagickImage(downscaled))
|
||||
{
|
||||
image.ResizeImage(factor, FilterType.Hermite, PixelInterpolateMethod.Mesh);
|
||||
image.Write("Hermite.png");
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"profiles": {
|
||||
"Test single img": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "source.png",
|
||||
"workingDirectory": "D:\\git\\ba_ocr\\ocr\\Implementation\\testdata"
|
||||
},
|
||||
"Refresh thesis results": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "source.png",
|
||||
"workingDirectory": "C:\\Users\\Simon\\Documents\\Userdata\\FH\\SEM5\\BA\\bsc\\include\\resampling"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 95 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 5.1 KiB |