Extract core related code to gcv_utils.
This commit is contained in:
parent
8d629cd384
commit
8aad62212a
5 changed files with 30 additions and 18 deletions
|
|
@ -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<cv::Point3f>;
|
||||
%template(GcvPoint2fVector) vector<cv::Point2f>;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
5
opencv2/gcv_utils/gcv_utils.go
Normal file
5
opencv2/gcv_utils/gcv_utils.go
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
package gcv_utils
|
||||
|
||||
// #cgo CXXFLAGS: -std=c++11
|
||||
// #cgo darwin pkg-config: opencv
|
||||
import "C"
|
||||
13
opencv2/gcv_utils/gcv_utils.swigcxx
Normal file
13
opencv2/gcv_utils/gcv_utils.swigcxx
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
%module gcv_utils
|
||||
%include "std_vector.i"
|
||||
|
||||
%{
|
||||
#include "gcv_utils.hpp"
|
||||
%}
|
||||
|
||||
%include "gcv_utils.hpp"
|
||||
|
||||
namespace std {
|
||||
%template(GcvPoint3fVector) vector<cv::Point3f>;
|
||||
%template(GcvPoint2fVector) vector<cv::Point2f>;
|
||||
};
|
||||
Loading…
Add table
Reference in a new issue