Comments (4)
I'm sorry that I didn't explain it anywhere correctly. If you train the NN for the characters 0-9 then you have to change internal var recognizableCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
to internal var recognizableCharacters = "0123456789"
in the SwiftOCR.swift file.
You should be able to ignore the separators and add them later.
func addSeperator(seperator: String, toMACAddress macAddress: String) -> String? {
guard macAddress.characters.count == 12 else {
return nil
}
//0..<6 because every MAC Adsress has 12 characters which are grouped into *6* groups
var seperatedMACAddressArray = [String]()
for sectionIndex in 0..<6 {
let substringRange = macAddress.startIndex.advancedBy(sectionIndex * 2)..<macAddress.startIndex.advancedBy(sectionIndex * 2 + 2)
let sectionSubstring = macAddress.substringWithRange(substringRange)
seperatedMACAddressArray.append(sectionSubstring)
}
let macAddress = seperatedMACAddressArray.joinWithSeparator(seperator)
return macAddress
}
SwiftOCR().recognize(myImage) {recognizedString in
let macAddress = addSeperator("-", toMACAddress: recognizedString)
}
Let me know if it worked. Good luck :-)
from swiftocr.
Hmm strange, when I change the recognisable characters to ABCDEF0123456789 it works very well but with the original set it doesn't pick up any single number. Why would that be?
from swiftocr.
The output of the NN looks somewhat like this [0.01, 0.5, 0.02]
. As you can see 0.5
is the largest output and it's index is 1. After SwiftOCR knows that, it will look what character is at index 1 of recognizableCharacters
and appends this character to recognizedString
(which in the end gets returned).
If you set recognizableCharacters
to "ABC"
then you would get B
as your result , but if you set it to "XYZ"
you will get Y
.
I hope this makes sense (I'm pretty bad at explaining ^^)
from swiftocr.
Aha, this is why the order of the recognisable characters is so critical!
I got it working perfectly with text on a Word document but we're trying to read the address from a crappy quality screen with low res text. I shall persevere! Thanks.
from swiftocr.
Related Issues (20)
- Cannot Build SwiftOCR with Swift 4.2 HOT 4
- Cannot build for macOS using CocoaPods
- How to install Swift OCR using Swift Package Manager?
- Can't Invoke NSimage image in method SwiftOCRInstance.recognize! HOT 1
- Any Wrapper for another programming language?
- Doesn't work on Xcode 10.2
- Low accuracy HOT 1
- Update recognizableCharacters not working
- Fix for crash in multithreaded apps
- crashed in FFNN.swift at line 228 HOT 1
- support for Xcode 11 Beta HOT 2
- Can SwiftOCR detect any language text or just english language ?
- No Output String HOT 4
- Statement about accuracy
- please support swift5.0 HOT 11
- Carthage not working
- Not compatible with Xcode 12 beta5 HOT 4
- cocoapods install error. not search tag 1.2.1
- No such module 'GPUImage' HOT 1
- Can the ios.deployment_target be lowered to 11.0?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftocr.