diff --git a/cmd/rv/AusOcean_logo_1080p.h264 b/cmd/rv/AusOcean_logo_1080p.h264 new file mode 100644 index 00000000..93332d45 Binary files /dev/null and b/cmd/rv/AusOcean_logo_1080p.h264 differ diff --git a/cmd/rv/probe_test.go b/cmd/rv/probe_test.go index 4468af0a..d5413f18 100644 --- a/cmd/rv/probe_test.go +++ b/cmd/rv/probe_test.go @@ -1,18 +1,34 @@ package main import ( - "fmt" + "io/ioutil" "testing" + + "gocv.io/x/gocv" ) -func TestMain(m *testing.M) { +func TestMain(t *testing.T) { + //ts := new(turbidityProbe) + const ( + rows = 2464 + cols = 3280 + ) - ts := new(turbidityProbe) + // Read frame + frame, err := ioutil.ReadFile("AusOcean_logo_1080p.h264") + if err != nil { + t.Fatal(err) + } - frame := make([]byte, 10) + // Decode + //mat, err := gocv.NewMatFromBytes(rows, cols, gocv.MatTypeCV8UC3, frame) + mat, err := gocv.IMDecode(frame, gocv.IMReadUnchanged) + if err != nil { + t.Fatal(err) + } + if mat.Empty() { + t.Fatal("Empty gocv.Mat") + } - size, err := ts.Write(frame) - - fmt.Println(size) - fmt.Println(err) + gocv.IMWrite("logo.jpg", mat) }