diff --git a/.circleci/config.yml b/.circleci/config.yml index 85bfbcc7..b4ad0827 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,9 +23,9 @@ jobs: - 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: key: v1-pkg-cache diff --git a/exp/gocv-exp/main.go b/exp/gocv-exp/main.go index 9de10184..8083df5a 100644 --- a/exp/gocv-exp/main.go +++ b/exp/gocv-exp/main.go @@ -1,3 +1,5 @@ +// +build !circleci + // What it does: // // This example detects motion using a delta threshold from the first frame, diff --git a/filter/filters_circleci.go b/filter/filters_circleci.go new file mode 100644 index 00000000..b5286f97 --- /dev/null +++ b/filter/filters_circleci.go @@ -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 + +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} +} diff --git a/filter/mog.go b/filter/mog.go index 7ae23ce2..283ea034 100644 --- a/filter/mog.go +++ b/filter/mog.go @@ -1,3 +1,5 @@ +// +build !circleci + /* DESCRIPTION A filter that detects motion and discards frames without motion. The @@ -45,7 +47,7 @@ type MOGFilter struct { 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 { bs := gocv.NewBackgroundSubtractorMOG2WithParams(history, threshold, false) k := gocv.GetStructuringElement(gocv.MorphRect, image.Pt(kernelSize, kernelSize))