diff --git a/examples/pvl_facedetect.go b/examples/pvl_facedetect.go index 24c652a5..fb6aeec0 100644 --- a/examples/pvl_facedetect.go +++ b/examples/pvl_facedetect.go @@ -44,6 +44,8 @@ func main() { defer img.Delete() fd := pvl.NewFaceDetector() + defer fd.Close() + fd.SetTrackingModeEnabled(true) fmt.Printf("start reading camera device: %v\n", deviceID) diff --git a/pvl/pvl.cpp b/pvl/pvl.cpp index 0a54e813..9b37a650 100644 --- a/pvl/pvl.cpp +++ b/pvl/pvl.cpp @@ -6,7 +6,7 @@ Face Face_New() return new cv::pvl::Face(); } -void Face_Delete(Face face) +void Face_Close(Face face) { delete face; } @@ -32,17 +32,13 @@ Rect Face_GetRect(Face face) return r; } -void Faces_Delete(struct Faces fs) { - delete fs.faces; -} - // FaceDetector FaceDetector FaceDetector_New() { return cv::pvl::FaceDetector::create(); } -void FaceDetector_Delete(FaceDetector f) +void FaceDetector_Close(FaceDetector f) { delete f; } diff --git a/pvl/pvl.go b/pvl/pvl.go index 8beda47c..7458029f 100644 --- a/pvl/pvl.go +++ b/pvl/pvl.go @@ -23,9 +23,9 @@ func NewFace() Face { return Face{p: C.Face_New()} } -// Delete Face. -func (f *Face) Delete() { - C.Face_Delete(f.p) +// Close Face. +func (f *Face) Close() { + C.Face_Close(f.p) f.p = nil } @@ -48,9 +48,9 @@ func NewFaceDetector() FaceDetector { return FaceDetector{p: C.FaceDetector_New()} } -// Delete object. -func (f *FaceDetector) Delete() { - C.FaceDetector_Delete(f.p) +// Close FaceDetector. +func (f *FaceDetector) Close() { + C.FaceDetector_Close(f.p) f.p = nil } diff --git a/pvl/pvl.h b/pvl/pvl.h index 86d4be75..a69b70ce 100644 --- a/pvl/pvl.h +++ b/pvl/pvl.h @@ -27,17 +27,13 @@ typedef struct Faces { // Face Face Face_New(); -void Face_Delete(Face f); +void Face_Close(Face f); void Face_CopyTo(Face src, Face dst); Rect Face_GetRect(Face f); -// Faces -struct Faces Faces_New(); -void Faces_Delete(struct Faces fs); - // FaceDetector FaceDetector FaceDetector_New(); -void FaceDetector_Delete(FaceDetector f); +void FaceDetector_Close(FaceDetector f); void FaceDetector_SetTrackingModeEnabled(FaceDetector f, bool enabled); struct Faces FaceDetector_DetectFaceRect(FaceDetector f, Mat img);