diff --git a/opencv2/gcv_calib3d/gcv_calib3d.swigcxx b/opencv2/gcv_calib3d/gcv_calib3d.swigcxx index f918e4e..64edfa2 100644 --- a/opencv2/gcv_calib3d/gcv_calib3d.swigcxx +++ b/opencv2/gcv_calib3d/gcv_calib3d.swigcxx @@ -1,15 +1,7 @@ %module gcv_calib3d -%include "std_vector.i" %{ #include "gcv_calib3d.hpp" -#include "gcv_core.hpp" %} %include "gcv_calib3d.hpp" -%include "gcv_core.hpp" - -namespace std { - %template(GcvPoint3fVector) vector; - %template(GcvPoint2fVector) vector; -}; diff --git a/opencv2/gcv_calib3d/gcv_calib3d_test.go b/opencv2/gcv_calib3d/gcv_calib3d_test.go index bdfb142..23d8b36 100644 --- a/opencv2/gcv_calib3d/gcv_calib3d_test.go +++ b/opencv2/gcv_calib3d/gcv_calib3d_test.go @@ -2,6 +2,8 @@ package gcv_calib3d import "testing" +import "github.com/lazywei/go-opencv/opencv2/gcv_utils" + // [[[ 0. 25. 0.] // [ 0. -25. 0.] // [-47. 25. 0.] @@ -16,17 +18,17 @@ import "testing" // [ 0.00000000e+00 0.00000000e+00 1.00000000e+00]] func TestGcvInitCameraMatrix2D(t *testing.T) { - objPts := NewGcvPoint3fVector(int64(4)) - objPts.Set(0, GetPoint3f(0, 25, 0)) - objPts.Set(1, GetPoint3f(0, -25, 0)) - objPts.Set(2, GetPoint3f(-47, 25, 0)) - objPts.Set(3, GetPoint3f(-47, -25, 0)) + objPts := gcv_utils.NewGcvPoint3fVector(int64(4)) + objPts.Set(0, gcv_utils.GetPoint3f(0, 25, 0)) + objPts.Set(1, gcv_utils.GetPoint3f(0, -25, 0)) + objPts.Set(2, gcv_utils.GetPoint3f(-47, 25, 0)) + objPts.Set(3, gcv_utils.GetPoint3f(-47, -25, 0)) - imgPts := NewGcvPoint2fVector(int64(4)) - imgPts.Set(0, GetPoint2f(1136.4140625, 1041.89208984)) - imgPts.Set(1, GetPoint2f(1845.33190918, 671.39581299)) - imgPts.Set(2, GetPoint2f(302.73373413, 634.79998779)) - imgPts.Set(3, GetPoint2f(1051.46154785, 352.76107788)) + imgPts := gcv_utils.NewGcvPoint2fVector(int64(4)) + imgPts.Set(0, gcv_utils.GetPoint2f(1136.4140625, 1041.89208984)) + imgPts.Set(1, gcv_utils.GetPoint2f(1845.33190918, 671.39581299)) + imgPts.Set(2, gcv_utils.GetPoint2f(302.73373413, 634.79998779)) + imgPts.Set(3, gcv_utils.GetPoint2f(1051.46154785, 352.76107788)) GcvInitCameraMatrix2D(objPts, imgPts) } diff --git a/opencv2/gcv_utils/gcv_utils.go b/opencv2/gcv_utils/gcv_utils.go new file mode 100644 index 0000000..45b5f12 --- /dev/null +++ b/opencv2/gcv_utils/gcv_utils.go @@ -0,0 +1,5 @@ +package gcv_utils + +// #cgo CXXFLAGS: -std=c++11 +// #cgo darwin pkg-config: opencv +import "C" diff --git a/opencv2/gcv_calib3d/gcv_core.hpp b/opencv2/gcv_utils/gcv_utils.hpp similarity index 100% rename from opencv2/gcv_calib3d/gcv_core.hpp rename to opencv2/gcv_utils/gcv_utils.hpp diff --git a/opencv2/gcv_utils/gcv_utils.swigcxx b/opencv2/gcv_utils/gcv_utils.swigcxx new file mode 100644 index 0000000..4cbba2e --- /dev/null +++ b/opencv2/gcv_utils/gcv_utils.swigcxx @@ -0,0 +1,13 @@ +%module gcv_utils +%include "std_vector.i" + +%{ +#include "gcv_utils.hpp" +%} + +%include "gcv_utils.hpp" + +namespace std { + %template(GcvPoint3fVector) vector; + %template(GcvPoint2fVector) vector; +};