Skip to content

Commit

Permalink
contrib/bgsegm: run go fmt on contributed code
Browse files Browse the repository at this point in the history
Signed-off-by: Ron Evans <[email protected]>
  • Loading branch information
deadprogram committed Dec 23, 2019
1 parent 0e1148f commit 3046969
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
22 changes: 11 additions & 11 deletions contrib/bgsegm.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ package contrib
import "C"

import (
"unsafe"
"unsafe"

"gocv.io/x/gocv"
"gocv.io/x/gocv"
)

// BackgroundSubtractorCNT is a wrapper around the cv::BackgroundSubtractorCNT.
type BackgroundSubtractorCNT struct {
// C.BackgroundSubtractorCNT
p unsafe.Pointer
// C.BackgroundSubtractorCNT
p unsafe.Pointer
}

// NewBackgroundSubtractorCNT returns a new BackgroundSubtractor algorithm
Expand All @@ -27,15 +27,15 @@ type BackgroundSubtractorCNT struct {
// https://docs.opencv.org/3.4/de/dca/classcv_1_1bgsegm_1_1BackgroundSubtractorCNT.html
//
func NewBackgroundSubtractorCNT() BackgroundSubtractorCNT {
return BackgroundSubtractorCNT{p: unsafe.Pointer(C.BackgroundSubtractorCNT_Create())}
return BackgroundSubtractorCNT{p: unsafe.Pointer(C.BackgroundSubtractorCNT_Create())}
}

// Close BackgroundSubtractorCNT.
func (b *BackgroundSubtractorCNT) Close() error {
C.BackgroundSubtractorCNT_Close((C.BackgroundSubtractorCNT)(b.p))
b.p = nil
C.BackgroundSubtractorCNT_Close((C.BackgroundSubtractorCNT)(b.p))
b.p = nil

return nil
return nil
}

// Apply computes a foreground mask using the current BackgroundSubtractorCNT.
Expand All @@ -44,7 +44,7 @@ func (b *BackgroundSubtractorCNT) Close() error {
// https://docs.opencv.org/3.4/de/dca/classcv_1_1bgsegm_1_1BackgroundSubtractorCNT.html
//
func (b *BackgroundSubtractorCNT) Apply(src gocv.Mat, dst *gocv.Mat) {
C.BackgroundSubtractorCNT_Apply((C.BackgroundSubtractorCNT)(b.p), (C.Mat)(src.Ptr()), (C.Mat)(dst.Ptr()))
C.BackgroundSubtractorCNT_Apply((C.BackgroundSubtractorCNT)(b.p), (C.Mat)(src.Ptr()), (C.Mat)(dst.Ptr()))

return
}
return
}
5 changes: 2 additions & 3 deletions contrib/bgsegm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package contrib

import (
"testing"

"gocv.io/x/gocv"
v "gocv.io/x/gocv/contrib"
)

func TestCNT(t *testing.T) {
Expand All @@ -16,7 +16,7 @@ func TestCNT(t *testing.T) {
dst := gocv.NewMat()
defer dst.Close()

cnt := v.NewBackgroundSubtractorCNT()
cnt := NewBackgroundSubtractorCNT()
defer cnt.Close()

cnt.Apply(img, &dst)
Expand All @@ -25,4 +25,3 @@ func TestCNT(t *testing.T) {
t.Error("Error in TestCNT test")
}
}

0 comments on commit 3046969

Please sign in to comment.