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