2014-07-24 07:38:46 +08:00
|
|
|
package opencv
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path"
|
|
|
|
"runtime"
|
|
|
|
"testing"
|
|
|
|
|
2017-03-28 02:10:37 +08:00
|
|
|
"gobot.io/x/gobot/gobottest"
|
2017-10-19 00:13:40 +08:00
|
|
|
"gocv.io/x/gocv"
|
2014-07-24 07:38:46 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestUtils(t *testing.T) {
|
|
|
|
_, currentfile, _, _ := runtime.Caller(0)
|
2017-10-05 23:05:10 +08:00
|
|
|
image := gocv.IMRead(path.Join(path.Dir(currentfile), "lena-256x256.jpg"), gocv.IMReadColor)
|
2017-10-23 17:45:36 +08:00
|
|
|
rect := DetectObjects("haarcascade_frontalface_alt.xml", image)
|
2016-02-22 13:21:24 +08:00
|
|
|
gobottest.Refute(t, len(rect), 0)
|
2017-10-05 23:05:10 +08:00
|
|
|
DrawRectangles(image, rect, 0, 0, 0, 0)
|
2014-07-24 07:38:46 +08:00
|
|
|
}
|