Last active
May 31, 2018 21:16
-
-
Save duanebester/5f7fdcc4225060bd27762e32c004dec8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Main extends App with OCR { | |
implicit val system: ActorSystem = ActorSystem("ocr") | |
implicit val executor: ExecutionContextExecutor = system.dispatcher | |
implicit val materializer: ActorMaterializer = ActorMaterializer() | |
implicit val jsonStreamingSupport = EntityStreamingSupport.json() | |
import MyJsonProtocol._ | |
def imageDeSkew:Flow[BufferedImage] = ??? | |
def imageToBinaryImage:Flow[BufferedImage] = ??? | |
def bufferedImageToMat:Flow[BufferedImage] = ??? | |
def matToBufferedImage:Flow[Mat] = ??? | |
def enhanceMat:Flow[Mat] = ??? | |
def imageOcr:Flow[BufferedImage] = ??? | |
def imageWriter:Flow[BufferedImage] = ??? | |
val route = | |
path("image" / "process") { | |
post { | |
fileUpload("fileUpload") { | |
case (fileInfo, fileStream) => | |
println(fileInfo) | |
val inputStream = fileStream.runWith(StreamConverters.asInputStream()) | |
val image: BufferedImage = ImageIO.read(inputStream) | |
// Process BufferedImage | |
complete("OK") | |
} | |
} | |
} | |
Http().bindAndHandle(route, "localhost", 8080) | |
} | |
object MyJsonProtocol | |
extends SprayJsonSupport | |
with DefaultJsonProtocol { | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment