this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

added "confidence" field to json

Added to json how confident model is for detecting word

authored by

Artem Bernatskyy and committed by
GitHub
603b3cbf 1bde420a

+2
+2
OCR/main.swift
··· 70 70 var line:[String:Any] = [:] 71 71 let candidate = observation.topCandidates(1).first 72 72 let string = candidate?.string 73 + let confidence = candidate?.confidence 73 74 // Find the bounding-box observation for the string range. 74 75 let stringRange = string!.startIndex..<string!.endIndex 75 76 let boxObservation = try? candidate?.boundingBox(for: stringRange) ··· 82 83 Int(imgRef.height)) 83 84 84 85 line["text"] = string ?? "" 86 + line["confidence"] = confidence ?? "" 85 87 line["x"] = Int(rect.minX) 86 88 line["width"] = Int(rect.size.width) 87 89 line["y"] = Int(CGFloat(imgRef.height) - rect.minY - rect.size.height)