RegulatedNoise - trade tool with zxctypo's best-in-class OCR (EliteOCRReader as-was)

Apologies if I've missed it, but the Commodities list doesn't fit on my screen - 1900x1080 - and if I take multiple screenshots, scrolling down each time, the 2nd+ shots don't really import correctly. I'm fairly sure a monitor doesn't exist that can fit the entire Comm. list - so how do you construct a series of shots so that everything gets grabbed?
 
Apologies if I've missed it, but the Commodities list doesn't fit on my screen - 1900x1080 - and if I take multiple screenshots, scrolling down each time, the 2nd+ shots don't really import correctly. I'm fairly sure a monitor doesn't exist that can fit the entire Comm. list - so how do you construct a series of shots so that everything gets grabbed?

I do the multiple screenshots, i do align them up though so no text is cut off. Works for me.
 
I do the multiple screenshots, i do align them up though so no text is cut off. Works for me.

I'm having it crash every single time on Lave/Lave Station, it can't make out "LAVIAN BRANDY" - I correct it once - works fine - next screenshot (they overlap), the software dies.
 
I mentioned I would have a stab at improving the best-guess algorithm in the event of not perfectly matching a known resource.

In Form1.cs, line 1847 (or near there, I've done some tinkering), we have the following code:

Code:
foreach (string reference in KnownCommodityNames)
{
	if (l.LD(reference.Replace(" ","").Replace("-","").Replace(".","").Replace(",","").ToUpper(), currentTextCamelCase.Replace(" ","").ToUpper()) < 3) // ignore spaces when using levenshtein to fis commodity names
	{
		_commodityTexts[_correctionRow, _correctionColumn] = reference.ToUpper();
		_originalBitmapConfidences[_correctionRow, _correctionColumn] = 1;
		break;
	}
}

The below code works by finding the closest match out of all possible commodities, which is much more likely to correctly identify the commodity correctly. From my testing, I've not had a single incorrect commodity detection (though I've had "MED" misdetected a couple of times, and an annoyingly placed floodlight mess up the station name).

Code:
var replacedCamelCase = currentTextCamelCase.Replace(" ", "").Replace("-", "").Replace(".", "").Replace(",", "").ToUpper();
var lowestLevenshteinNumber = 10000;
var nextLowestLevenshteinNumber = 10000;
var lowestMatchingCommodity = "";
var lowestMatchingCommodityRef = "";
foreach (string reference in KnownCommodityNames)
{
	var upperRef = reference.Replace(" ", "").Replace("-", "").Replace(".", "").Replace(",", "").ToUpper();
	var levenshteinNumber = l.LD(upperRef, replacedCamelCase);

	if (upperRef != lowestMatchingCommodityRef)
	{
		if (levenshteinNumber <= lowestLevenshteinNumber)
		{
			nextLowestLevenshteinNumber = lowestLevenshteinNumber;
			lowestLevenshteinNumber = levenshteinNumber;
			lowestMatchingCommodityRef = upperRef;
			lowestMatchingCommodity = reference.ToUpper();
		}
		else if (levenshteinNumber < nextLowestLevenshteinNumber)
		{
			nextLowestLevenshteinNumber = levenshteinNumber;
		}
	}
}

if (lowestLevenshteinNumber + 16 < nextLowestLevenshteinNumber) // ignore spaces when using levenshtein to find commodity names
{
	_commodityTexts[_correctionRow, _correctionColumn] = lowestMatchingCommodity;
	_originalBitmapConfidences[_correctionRow, _correctionColumn] = 1;
}

The "+ 16" may need some tuning or, preferably, being made configurable. Generally I see levenshtein values of 60+ for non-matching items (like comparing HTETSUITS with TITANIUM) and 22 or lower for matches (22 is the value for comparing HESUITS and HTETSUITS, one of my most common errors).
 
Last edited:
I'm having it crash every single time on Lave/Lave Station, it can't make out "LAVIAN BRANDY" - I correct it once - works fine - next screenshot (they overlap), the software dies.

The issue here appears to be that if multiple screenshots are queued, and you have to make an OCR correction, it will crash. Not sure if it's been reported by anyone explicitly, but it certainly happens to me. The workaround is to take one screenshot at a time, switching to RegulatedNoise each time to correct any OCR errors, before taking the next screenshot. Hopefully the change I posted above would improve this situation as well.
 
The issue here appears to be that if multiple screenshots are queued, and you have to make an OCR correction, it will crash. Not sure if it's been reported by anyone explicitly, but it certainly happens to me. The workaround is to take one screenshot at a time, switching to RegulatedNoise each time to correct any OCR errors, before taking the next screenshot. Hopefully the change I posted above would improve this situation as well.

Tried that; now it just crashes after correcting LAVIAN BRANDY. :/ It had pulled up "HIGH" to correct next but crashed. (Perhaps it's because LAVIAN BRANDY is sold out, but says HIGH supply but 0 avail?)
 
Tried that; now it just crashes after correcting LAVIAN BRANDY. :/ It had pulled up "HIGH" to correct next but crashed. (Perhaps it's because LAVIAN BRANDY is sold out, but says HIGH supply but 0 avail?)

I've had screenshots where I've had to correct more than one thing, but they've not crashed for me (yet). I've had "H1GH" as something to correct a couple of times, I'm thinking matching the closest of "HIGH/MED/LOW" for each of the demand columns should solve this.

Probably need to get the list of rares added to the list of known commodities - currently this is hard coded but it could benefit from being placed in a separate text file that gets loaded on startup.
 
Last edited:
Thuffyr said:
Does I understand well that when I enter new prices data from station by doing printscreen and using OCR, these data will be automatically updated onliine?

Yep; if (and only if) you tick the "Post data to EDDN on Import" box on the OCR => Capture and Correct tab, then yes, it will automatically upload your data to the EDDN rebroadcaster, which will then send it to anyone who is listening at that moment.

Thuffyr said:
for what use is the webserver?

So that you can fix OCR errors and view price data, without having to flip out of Elite Dangerous. You can, for instance, view the webserver on your phone or tablet, and see price information that way. Brilliant if you need it, useless if you don't! :D

Thuffyr said:
Start Listening... MSVCP120.dll

Well, I didn't realise this, but it seems that the ZeroMQ component I use for EDDN listening, requires the Microsoft Visual Studio 2013 C++ Runtimes. You can get them here => http://www.microsoft.com/en-gb/download/details.aspx?id=40784 and thanks for the heads-up, I will add this to the first post.

iAmLegion said:
loads of ideas

Thanks, I will take those into consideration when I have more time :)

Marikc0 said:
Parameter is not valid. at RegulatedNoise.Ocr.Crop(Bitmap b, Rectangle r)
iAmLegion said:
Redid the calibration and it works better

More calibration problems. I suppose we need auto-calibration quite badly now.

Thuffyr said:
Can it remember last selected station instead of always selecting the first in the list?

Added to the to-do list :)

Kepler said:
Its great every time I log on there is a new version, with new features !!! Brilliant !!!

Would an option to exclude data older than a certain date be good ??

:-D but be warned, now the Christmas break is over, updates will be less frequent. But I will keep sharing the source code, because this sort of thing is awesome:

ImaginaryEd said:
<big old pile of code>

Many thanks for this, ImaginaryEd. I'm just going to drop this straight in the next version and we'll see if it needs tweaking or if we need to make the +16 parameterised. The community will feed back! :D

iAmLegion said:
multiple screenshots, i do align them up though so no text is cut off

Correct, this is the best way to do it. Multiple screenshots should queue up properly and be processed one-by-one - even if there are corrections in some or all of the screenshots.

ImaginaryEd said:
I mentioned in my previous post that a floodlight is messing up the station name

I'm open to suggestions about what we can do about that - apart from force the user to validate the station name (i.e. kill the auto-import, which someone asked to be configurable anyway IIRC)

ImaginaryEd said:
if multiple screenshots are queued, and you have to make an OCR correction, it will crash.

This shouldn't be happening, and indeed it doesn't happen for me. Let's see if v1.31 with your change makes any difference, if not I'll add more debug code.

Vendraen said:
LAVIAN BRANDY

Weird. Can you post a screenshot that causes it to crash, plus the values out of your calibration.txt plz? With both of those, it should crash for me too, then I can investigate.

I've had "H1GH" as something to correct a couple of times, I'm thinking matching the closest of "HIGH/MED/LOW" for each of the demand columns should solve this.

Spot-on - LOW/MED/HIGH always works for me cos I'm at 2560x1440, but as you say it should be easy enough to match as per the commodity names. One more thing for the to-do list!

Probably need to get the list of rares added to the list of known commodities - currently this is hard coded but it could benefit from being placed in a separate text file that gets loaded on startup.

Yep, the commodities list is a manually-tidied dump from EDDN at the moment, a five-minutes-of-code improvement - you are absolutely right about extending and exposing the list...

Sorry for anyone whose post I missed BTW, it's getting hard to keep track of. I almost feel like we need a bug tracker! :-/
 
BTW, what is the number to the right of the text correction box? (Usually has .73 and such?)

It's Tesseract's confidence level that its answer is correct - 73% or similar...

- - - - - Additional Content Posted / Auto Merge - - - - -

Sure. Here's the calibration.txt - View attachment 6679 But the forum won't let me attach the screenshot as it is too large (5.9mb).

Post it to imgur.com and link here?
 
Just got this error when doing the ocr

see the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at RegulatedNoise.Form1.ContinueDisplayingResults() in c:\Users\Max\Documents\Visual Studio 2013\Projects\RegulatedNoise\RegulatedNoise\Form1.cs:line 1913
at RegulatedNoise.Form1.bContinueOcr_Click(Object sender, EventArgs e) in c:\Users\Max\Documents\Visual Studio 2013\Projects\RegulatedNoise\RegulatedNoise\Form1.cs:line 2224
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34014 built by: FX45W81RTMGDR
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
RegulatedNoise
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Users/Magnus/Desktop/Elite/RegulatedNoise%20v1.2/RegulatedNoise.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34239 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms.DataVisualization
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.33440
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.DataVisualization/v4.0_4.0.0.0__31bf3856ad364e35/System.Windows.Forms.DataVisualization.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34230 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
Microsoft.GeneratedCode
Assembly Version: 1.0.0.0
Win32 Version: 4.0.30319.34230 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
Microsoft.GeneratedCode
Assembly Version: 1.0.0.0
Win32 Version: 4.0.30319.34230 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
Tesseract
Assembly Version: 2.1.1.1
Win32 Version: 2.1.1.1
CodeBase: file:///C:/Users/Magnus/Desktop/Elite/RegulatedNoise%20v1.2/Tesseract.DLL
----------------------------------------
InteropRuntimeImplementer.LeptonicaApiSignaturesInstance
Assembly Version: 0.0.0.0
Win32 Version: 2.1.1.1
CodeBase: file:///C:/Users/Magnus/Desktop/Elite/RegulatedNoise%20v1.2/Tesseract.dll
----------------------------------------
InteropRuntimeImplementer.TessApiSignaturesInstance
Assembly Version: 0.0.0.0
Win32 Version: 2.1.1.1
CodeBase: file:///C:/Users/Magnus/Desktop/Elite/RegulatedNoise%20v1.2/Tesseract.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

- - - - - Additional Content Posted / Auto Merge - - - - -

It also seems the background is messing things up, the "COMMS" in the background makes olsen stations become olsen station'' i think it's due to the line above the comms text that mess it up. (so not i sent bad data to that other network :( )
 
Btw, if you happen to need a database i can provide a MySQL db for you if you want, we could host prices on it from everyone then :D
 
Just got this error when doing the ocr

Object reference not set to an instance of an object. at RegulatedNoise.Form1.ContinueDisplayingResults() in c:\Users\Max\Documents\Visual Studio 2013\Projects\RegulatedNoise\RegulatedNoise\Form1.cs:line 1913

Brilliant, I can see a suddenly-obvious fix that needs to go in here. Hopefully it will fix a few other people's problems too. V1.32 incoming I guess! :)
 
Just trying this out again, and screenshot monitoring doesn't seem to work for me. I calibrated the OCR, and it says 6 queued, but it isn't actually processing any of them. Just says Correct value: Working... and stays there forever with the first screenshot.
I've also got a process spawned off that takes 1 core's full processing ability, and never goes away until I manually end it. Probably the OCR thread.
 
Last edited:
I see source has been made available for this. Have you considered hosting it on Github? It's quite easy to work with and would make any collaboration with other developers much easier.

I've grabbed a copy of the source and hope to make the time to take a look at some stage soon.
 
Back
Top Bottom