DRS recognition is now tested
This commit is contained in:
1 parent
e854a9e702
commit
ce237a9a3f
114 files changed
+223
-4
No files matched your search
@@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrackTrends", "TrackTrends\
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{BAFC8496-36AE-4539-94DE-0E505E7A8F93}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrackTrendsTests", "TrackTrendsTests\TrackTrendsTests.csproj", "{9BE68783-F589-479A-8CFA-9652C3B23A37}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -17,6 +19,10 @@ Global
|
||||
{F6694884-3B45-4017-9C9A-A0AFFC508245}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F6694884-3B45-4017-9C9A-A0AFFC508245}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F6694884-3B45-4017-9C9A-A0AFFC508245}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9BE68783-F589-479A-8CFA-9652C3B23A37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9BE68783-F589-479A-8CFA-9652C3B23A37}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9BE68783-F589-479A-8CFA-9652C3B23A37}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9BE68783-F589-479A-8CFA-9652C3B23A37}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -15,7 +15,7 @@ using Tesseract;
|
||||
|
||||
namespace TrackTrends
|
||||
{
|
||||
internal class DriverDrsWindow:Window
|
||||
public class DriverDrsWindow:Window
|
||||
{
|
||||
private static int EmptyDrsGreenValue = -1;
|
||||
private static Random rnd = new Random();
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace TrackTrends
|
||||
/// </summary>
|
||||
/// <param name="type">The type of the window. Depending on it different enhancing features will be applied</param>
|
||||
/// <returns>The enhanced Bitmap</returns>
|
||||
public Bitmap Enhance(int id,WindowType type = WindowType.Text)
|
||||
public Bitmap Enhance(WindowType type = WindowType.Text)
|
||||
{
|
||||
Bitmap outputBitmap = (Bitmap)InputBitmap.Clone();
|
||||
//Note : If you plan to activate all the comments that I used to debug the OCR I would advise to make sure that the debug folder exists
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace TrackTrends
|
||||
}
|
||||
|
||||
|
||||
Bitmap enhancedImage = new OcrImage(image).Enhance(salt, windowType);
|
||||
Bitmap enhancedImage = new OcrImage(image).Enhance(windowType);
|
||||
|
||||
var tessImage = Pix.LoadFromMemory(ImageToByte(enhancedImage));
|
||||
|
||||
@@ -578,7 +578,7 @@ namespace TrackTrends
|
||||
Engine.SetVariable("tessedit_char_whitelist", allowedChars);
|
||||
|
||||
Bitmap rawData = image;
|
||||
Bitmap enhancedImage = new OcrImage(rawData).Enhance(salt, windowType);
|
||||
Bitmap enhancedImage = new OcrImage(rawData).Enhance(windowType);
|
||||
|
||||
Page page = Engine.Process(enhancedImage);
|
||||
using (var iter = page.GetIterator())
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using TrackTrends;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
|
||||
namespace TrackTrends.Tests
|
||||
{
|
||||
[TestClass()]
|
||||
public class OcrImageTests
|
||||
{
|
||||
[TestMethod()]
|
||||
public void LapTimeOCR_Test()
|
||||
{
|
||||
Assert.Fail();
|
||||
}
|
||||
[TestMethod()]
|
||||
public void PositionOCR_Test()
|
||||
{
|
||||
Assert.Fail();
|
||||
}
|
||||
[TestMethod()]
|
||||
public void GapToLeaderOCR_Test()
|
||||
{
|
||||
Assert.Fail();
|
||||
}
|
||||
[TestMethod()]
|
||||
public void DRS_OCR_Test()
|
||||
{
|
||||
string directory = @"./../../TestImages/DRS/";
|
||||
DirectoryInfo directoryInfo = new DirectoryInfo(directory);
|
||||
if (Directory.Exists(directory))
|
||||
{
|
||||
Bitmap falseExemple = (Bitmap)Image.FromFile(directory + "False.png");
|
||||
Bitmap trueExemple = (Bitmap)Image.FromFile(directory + "True.png");
|
||||
|
||||
DriverDrsWindow falseDRS = new DriverDrsWindow(falseExemple, new Rectangle(0, 0, falseExemple.Width, falseExemple.Height), true);
|
||||
DriverDrsWindow trueDRS = new DriverDrsWindow(trueExemple, new Rectangle(0, 0, trueExemple.Width, trueExemple.Height), true);
|
||||
|
||||
bool falseResult = (bool)falseDRS.DecodePng();
|
||||
bool trueResult = (bool)trueDRS.DecodePng();
|
||||
|
||||
Assert.IsFalse(falseResult);
|
||||
Assert.IsTrue(trueResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Fail();
|
||||
}
|
||||
}
|
||||
[TestMethod()]
|
||||
public void DriverNameOCR_Test()
|
||||
{
|
||||
Assert.Fail();
|
||||
}
|
||||
[TestMethod()]
|
||||
public void SectorOCR_Test()
|
||||
{
|
||||
Assert.Fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("TrackTrendsTests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TrackTrendsTests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2023")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("9be68783-f589-479a-8cfa-9652c3b23a37")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 114 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user