Skip to content

Commit

Permalink
Mat can be deleted
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Sep 20, 2017
1 parent ea376b3 commit 6599469
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions core.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#include "core.h"
#include <string.h>

// Mat
Mat Mat_New() {
return new cv::Mat();
}

void Mat_Delete(Mat m) {
delete m;
}

// MatVec3b
MatVec3b MatVec3b_New() {
return new cv::Mat_<cv::Vec3b>();
}
Expand Down
6 changes: 6 additions & 0 deletions core.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ func NewMat() Mat {
return Mat{p: C.Mat_New()}
}

// Delete object.
func (m *Mat) Delete() {
C.Mat_Delete(m.p)
m.p = nil
}

// CMatVec3b is an alias for C pointer.
type CMatVec3b C.MatVec3b

Expand Down
3 changes: 2 additions & 1 deletion core.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ typedef struct RawData {
void DrawRectsToImage(MatVec3b img, struct Rects rects);

Mat Mat_New();

void Mat_Delete(Mat m);

MatVec3b MatVec3b_New();
struct ByteArray MatVec3b_ToJpegData(MatVec3b m, int quality);
void MatVec3b_Delete(MatVec3b m);
Expand Down

0 comments on commit 6599469

Please sign in to comment.