summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArturs Artamonovs <arturs.artamonovs@protonmail.com>2021-03-04 19:28:42 +0000
committerArturs Artamonovs <arturs.artamonovs@protonmail.com>2021-03-04 19:28:42 +0000
commita80e5b22f6bfc6ef115b8e88ed495fe1f5c1663f (patch)
tree92d6705d9a26898af8710cb924f927295cc12dec
parent16ea3ed434852a3101e62515812393afb6397bc7 (diff)
downloadOCRImage-a80e5b22f6bfc6ef115b8e88ed495fe1f5c1663f.tar.gz
OCRImage-a80e5b22f6bfc6ef115b8e88ed495fe1f5c1663f.zip
Sample image for testing, TextPiece class defined
-rw-r--r--ExampleInput/sample.pngbin0 -> 1197827 bytes
-rw-r--r--OCRImage/main.swift36
2 files changed, 36 insertions, 0 deletions
diff --git a/ExampleInput/sample.png b/ExampleInput/sample.png
new file mode 100644
index 0000000..ced0eda
--- /dev/null
+++ b/ExampleInput/sample.png
Binary files differ
diff --git a/OCRImage/main.swift b/OCRImage/main.swift
index 3941dee..7669f06 100644
--- a/OCRImage/main.swift
+++ b/OCRImage/main.swift
@@ -8,9 +8,36 @@
import Foundation
import ArgumentParser
+class TextPiece {
+ var text:String?;
+ var topLeft:CGPoint;
+ var topRight:CGPoint;
+ var bottomLeft:CGPoint;
+ var bottomRIght:CGPoint;
+
+ init(_ t: String, _ tl:CGPoint, _ tr:CGPoint, _ bl:CGPoint, _ br: CGPoint ) {
+ self.text = t;
+ self.topLeft = tl;
+ self.topRight = tr;
+ self.bottomLeft = bl;
+ self.bottomRIght = br;
+ }
+}
+
print("Start program")
+let stderr = FileHandle.standardError
+
+if #available(macOS 10.15,*) {} else {
+ //Output to stderr if os version is not supported
+ stderr.write("Version of MacOS should be >=10.15".data(using: .utf8)!)
+ exit(0)
+}
+
struct OCROptions : ParsableArguments {
+ @Option(help:"Input file for OCR")
+ var inputFile:String = "/Users/jackyjack/Projects/OCRImage/ExampleInput/sample.png"
+
@Flag(name: .shortAndLong, help:"Show extra debugion info")
var debug=false
@@ -20,4 +47,13 @@ struct OCROptions : ParsableArguments {
let options = OCROptions.parseOrExit()
+if options.version {
+ print("Version: 0.0.1")
+}
+
+print("OCR Input file: \(options.inputFile)")
+
+
+
+
print("End programm")