2024-11-01 12:54:20 +01:00
|
|
|
//go:build gocv
|
|
|
|
// +build gocv
|
|
|
|
|
2014-07-23 16:38:46 -07:00
|
|
|
package opencv
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path"
|
|
|
|
"runtime"
|
|
|
|
"testing"
|
|
|
|
|
2023-10-20 10:27:09 +02:00
|
|
|
"github.com/stretchr/testify/assert"
|
2023-11-15 20:51:52 +01:00
|
|
|
|
2017-10-18 18:13:40 +02:00
|
|
|
"gocv.io/x/gocv"
|
2014-07-23 16:38:46 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestUtils(t *testing.T) {
|
|
|
|
_, currentfile, _, _ := runtime.Caller(0)
|
2017-10-05 17:05:10 +02:00
|
|
|
image := gocv.IMRead(path.Join(path.Dir(currentfile), "lena-256x256.jpg"), gocv.IMReadColor)
|
2017-10-23 11:45:36 +02:00
|
|
|
rect := DetectObjects("haarcascade_frontalface_alt.xml", image)
|
2023-10-20 10:27:09 +02:00
|
|
|
assert.NotEqual(t, 0, len(rect))
|
2017-10-05 17:05:10 +02:00
|
|
|
DrawRectangles(image, rect, 0, 0, 0, 0)
|
2014-07-23 16:38:46 -07:00
|
|
|
}
|