av/cmd/rv/probe_test.go

35 lines
539 B
Go
Raw Normal View History

package main
import (
2022-01-10 06:47:52 +03:00
"io/ioutil"
"testing"
2022-01-10 06:47:52 +03:00
"gocv.io/x/gocv"
)
2022-01-10 06:47:52 +03:00
func TestMain(t *testing.T) {
//ts := new(turbidityProbe)
const (
rows = 2464
cols = 3280
)
2022-01-10 06:47:52 +03:00
// Read frame
frame, err := ioutil.ReadFile("AusOcean_logo_1080p.h264")
if err != nil {
t.Fatal(err)
}
2022-01-10 06:47:52 +03:00
// 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")
}
2022-01-10 06:47:52 +03:00
gocv.IMWrite("logo.jpg", mat)
}