mirror of https://bitbucket.org/ausocean/av.git
error message for decoding image
This commit is contained in:
parent
40b5374856
commit
8c32265ae3
|
@ -29,6 +29,7 @@ LICENSE
|
||||||
package filter
|
package filter
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
"image/color"
|
||||||
"io"
|
"io"
|
||||||
|
@ -74,7 +75,10 @@ func (m *KNNFilter) Close() error {
|
||||||
// Write applies the motion filter to the video stream. Only frames with motion
|
// Write applies the motion filter to the video stream. Only frames with motion
|
||||||
// are written to the destination encoder, frames without are discarded.
|
// are written to the destination encoder, frames without are discarded.
|
||||||
func (m *KNNFilter) Write(f []byte) (int, error) {
|
func (m *KNNFilter) Write(f []byte) (int, error) {
|
||||||
img, _ := gocv.IMDecode(f, gocv.IMReadColor)
|
img, err := gocv.IMDecode(f, gocv.IMReadColor)
|
||||||
|
if err != nil {
|
||||||
|
return 0, fmt.Errorf("can't decode image: %w", err)
|
||||||
|
}
|
||||||
defer img.Close()
|
defer img.Close()
|
||||||
|
|
||||||
imgDelta := gocv.NewMat()
|
imgDelta := gocv.NewMat()
|
||||||
|
|
Loading…
Reference in New Issue