Use simple function instead of class.

This commit is contained in:
Chih-Wei Chang 2015-02-14 22:36:28 +08:00
parent 9dbdf34f32
commit 8d629cd384
2 changed files with 14 additions and 36 deletions

View file

@ -17,16 +17,16 @@ import "testing"
func TestGcvInitCameraMatrix2D(t *testing.T) {
objPts := NewGcvPoint3fVector(int64(4))
objPts.Set(0, NewGcvPoint3f(0, 25, 0).Get())
objPts.Set(1, NewGcvPoint3f(0, -25, 0).Get())
objPts.Set(2, NewGcvPoint3f(-47, 25, 0).Get())
objPts.Set(3, NewGcvPoint3f(-47, -25, 0).Get())
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))
imgPts := NewGcvPoint2fVector(int64(4))
imgPts.Set(0, NewGcvPoint2f(1136.4140625, 1041.89208984).Get())
imgPts.Set(1, NewGcvPoint2f(1845.33190918, 671.39581299).Get())
imgPts.Set(2, NewGcvPoint2f(302.73373413, 634.79998779).Get())
imgPts.Set(3, NewGcvPoint2f(1051.46154785, 352.76107788).Get())
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))
GcvInitCameraMatrix2D(objPts, imgPts)
}

View file

@ -3,32 +3,10 @@
using namespace std;
class GcvPoint3f
{
public:
GcvPoint3f (float x, float y, float z)
: _data(x, y, z) {};
~GcvPoint3f () {};
cv::Point3f Get() { return _data; }
void Set(float x, float y, float z) {
_data = cv::Point3f(x, y, z);
cv::Point3f GetPoint3f(float x, float y, float z) {
return cv::Point3f(x, y, z);
}
private:
cv::Point3f _data;
};
class GcvPoint2f
{
public:
GcvPoint2f (float x, float y)
: _data(x, y) {};
~GcvPoint2f () {};
cv::Point2f Get() { return _data; }
void Set(float x, float y) {
_data = cv::Point2f(x, y);
cv::Point2f GetPoint2f(float x, float y) {
return cv::Point2f(x, y);
}
private:
cv::Point2f _data;
};