From 90a8832ab9e1a855d526db04ecfc3645725c5964 Mon Sep 17 00:00:00 2001 From: BroodjeAap Date: Mon, 6 Jul 2020 17:33:19 +0000 Subject: [PATCH] got decoding/encoding in/out gocv working --- main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 7c0900f..74102db 100755 --- a/main.go +++ b/main.go @@ -3,7 +3,6 @@ package main import ( "crypto/sha256" "encoding/base64" - "fmt" "io/ioutil" "log" "net/http" @@ -56,10 +55,11 @@ func stream(w http.ResponseWriter, r *http.Request) { // TODO async for this? saveStreamInstant(URL, img) - w.Write([]byte(img)) + mat, err := gocv.IMDecode(img, gocv.IMReadColor) - gocvImg := gocv.IMRead(filepath.Join(".", "streams", "vERFlpF_5Y-AgJ06PjD8-LtylFJXEjbqJp0g3he5Ngs=", "current.jpg"), gocv.IMReadColor) - fmt.Println(gocvImg.Empty()) + gocvIMG, err := gocv.IMEncode(".jpg", mat) + + w.Write(gocvIMG) } func saveStreamInstant(URL string, img []byte) {