mirror of https://bitbucket.org/ausocean/av.git
closing debug file
This commit is contained in:
parent
ca0b146419
commit
40b282f39d
|
@ -42,18 +42,14 @@ import (
|
|||
"golang.org/x/image/math/fixed"
|
||||
)
|
||||
|
||||
const filename = "motion.mjpeg"
|
||||
const debugfile = "motion.mjpeg"
|
||||
|
||||
const (
|
||||
threshold = 45000
|
||||
pixels = 1000
|
||||
)
|
||||
|
||||
type pixel struct {
|
||||
r uint32
|
||||
g uint32
|
||||
b uint32
|
||||
}
|
||||
type pixel struct{ r, g, b uint32 }
|
||||
|
||||
// BasicFilter is a filter that provides basic motion detection via a difference
|
||||
// method.
|
||||
|
@ -76,20 +72,19 @@ func NewBasicFilter(dst io.WriteCloser, debug bool) *Basic {
|
|||
var err error
|
||||
file = nil
|
||||
if debug {
|
||||
file, err = os.Create(filename)
|
||||
file, err = os.Create(debugfile)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("could not create debug file: %v", err))
|
||||
}
|
||||
} else {
|
||||
file = nil
|
||||
}
|
||||
return &Basic{dst, nil, nil, bwImg, 0, 0, file, 0, debug}
|
||||
}
|
||||
|
||||
// Implements io.Closer.
|
||||
// Close frees resources used by gocv, because it has to be done manually, due to
|
||||
// it using c-go.
|
||||
func (bf *Basic) Close() error {
|
||||
if bf.debug {
|
||||
bf.file.Close()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue