diff --git a/gocv/gocv_calib3d.go b/gocv/gocv_calib3d.go index a49ca0e..2ced4e3 100644 --- a/gocv/gocv_calib3d.go +++ b/gocv/gocv_calib3d.go @@ -31,7 +31,7 @@ func GcvInitCameraMatrix2D(objPts, imgPts *mat64.Dense) (camMat *mat64.Dense) { imgPts.At(i, 0), imgPts.At(i, 1))) } - camMat = MatToMat64(GcvInitCameraMatrix2D_(objPtsVec, imgPtsVec)) + camMat = GcvMatToMat64(GcvInitCameraMatrix2D_(objPtsVec, imgPtsVec)) return camMat } diff --git a/gocv/gocv_core.cpp b/gocv/gocv_core.cpp index d5b4256..d448255 100644 --- a/gocv/gocv_core.cpp +++ b/gocv/gocv_core.cpp @@ -5,7 +5,7 @@ #include "gocv_core.hpp" -cv::Mat ToMat_(int row, int col, std::vector data) { +cv::Mat Mat64ToGcvMat_(int row, int col, std::vector data) { assert(row * col == data.size()); cv::Mat mat = cv::Mat(row, col, CV_64F); diff --git a/gocv/gocv_core.go b/gocv/gocv_core.go index 05ab78c..279c7f2 100644 --- a/gocv/gocv_core.go +++ b/gocv/gocv_core.go @@ -33,7 +33,7 @@ func NewGcvSize2f64(x, y float64) GcvSize2f64_ { // The reason is the latter is much easier to handle // in Go. // GcvMat is assumed to be 2-dimensional matrix. -func MatToMat64(mat Mat) *mat64.Dense { +func GcvMatToMat64(mat GcvMat) *mat64.Dense { col := mat.GetCols() row := mat.GetRows() @@ -54,7 +54,7 @@ func MatToMat64(mat Mat) *mat64.Dense { } // Convert *mat64.Dense to Mat -func ToMat(mat *mat64.Dense) Mat { +func Mat64ToGcvMat(mat *mat64.Dense) GcvMat { row, col := mat.Dims() rawData := NewGcvFloat64Vector(int64(row * col)) @@ -65,5 +65,5 @@ func ToMat(mat *mat64.Dense) Mat { } } - return ToMat_(row, col, rawData) + return Mat64ToGcvMat_(row, col, rawData) } diff --git a/gocv/gocv_core.hpp b/gocv/gocv_core.hpp index 9210e09..90074d5 100644 --- a/gocv/gocv_core.hpp +++ b/gocv/gocv_core.hpp @@ -2,4 +2,4 @@ #include #include -cv::Mat ToMat_(int row, int col, std::vector data); +cv::Mat Mat64ToGcvMat_(int row, int col, std::vector data); diff --git a/gocv/gocv_core.i b/gocv/gocv_core.i index 47e782e..9f9ed69 100644 --- a/gocv/gocv_core.i +++ b/gocv/gocv_core.i @@ -192,6 +192,8 @@ namespace cv { /* ----------------- Mat ----------------- */ + %rename(GcvMat) Mat; + class Mat { public: diff --git a/gocv/gocv_core_test.go b/gocv/gocv_core_test.go index 4c082fb..c327e3b 100644 --- a/gocv/gocv_core_test.go +++ b/gocv/gocv_core_test.go @@ -23,16 +23,16 @@ func TestNewGcvSize2f64(t *testing.T) { } func TestMat(t *testing.T) { - mat := NewMat() - mat2 := NewMat(mat) + mat := NewGcvMat() + mat2 := NewGcvMat(mat) spew.Dump(mat2) } -func TestToMat(t *testing.T) { +func TestMat64ToGcvMat(t *testing.T) { mat := mat64.NewDense(3, 2, []float64{ 0, 1, 1.23, 4, -12.3, -4, }) - spew.Dump(ToMat(mat)) + spew.Dump(Mat64ToGcvMat(mat)) }