Circle-CV ignores gocv/OpenCV for testing.

This commit is contained in:
Scott 2019-12-31 12:26:35 +10:30
parent 016bbf0553
commit e0760f0096
4 changed files with 44 additions and 3 deletions

View File

@ -23,9 +23,9 @@ jobs:
- run: go get -d -t -v ./... - run: go get -d -t -v ./...
- run: go build -v ./... - run: go build -v -tags circleci ./...
- run: go test -v ./... - run: go test -v -tags circleci ./...
- save_cache: - save_cache:
key: v1-pkg-cache key: v1-pkg-cache

View File

@ -1,3 +1,5 @@
// +build !circleci
// What it does: // What it does:
// //
// This example detects motion using a delta threshold from the first frame, // This example detects motion using a delta threshold from the first frame,

View File

@ -0,0 +1,37 @@
// +build circleci
/*
DESCRIPTION
Replaces filters that use the gocv package when Circle-CI builds revid. This
is needed because Circle-CI does not have a copy of Open CV installed.
AUTHORS
Scott Barnard <scott@ausocean.org>
LICENSE
filters_circleci.go is Copyright (C) 2019 the Australian Ocean Lab (AusOcean)
It is free software: you can redistribute it and/or modify them
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
It is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
in gpl.txt. If not, see http://www.gnu.org/licenses.
*/
package filter
import (
"io"
)
// NewMOGFilter returns a pointer to a new NoOp struct for testing purposes only.
func NewMOGFilter(dst io.WriteCloser, area, threshold float64, history, kernelSize int, debug bool) *NoOp {
return &NoOp{dst: dst}
}

View File

@ -1,3 +1,5 @@
// +build !circleci
/* /*
DESCRIPTION DESCRIPTION
A filter that detects motion and discards frames without motion. The A filter that detects motion and discards frames without motion. The
@ -45,7 +47,7 @@ type MOGFilter struct {
windows []*gocv.Window windows []*gocv.Window
} }
// NewMOGFilter returns a pointer to a new MOGFilter. // NewMOGFilter returns a pointer to a new MOGFilter struct.
func NewMOGFilter(dst io.WriteCloser, area, threshold float64, history, kernelSize int, debug bool) *MOGFilter { func NewMOGFilter(dst io.WriteCloser, area, threshold float64, history, kernelSize int, debug bool) *MOGFilter {
bs := gocv.NewBackgroundSubtractorMOG2WithParams(history, threshold, false) bs := gocv.NewBackgroundSubtractorMOG2WithParams(history, threshold, false)
k := gocv.GetStructuringElement(gocv.MorphRect, image.Pt(kernelSize, kernelSize)) k := gocv.GetStructuringElement(gocv.MorphRect, image.Pt(kernelSize, kernelSize))