From 8d629cd3847094ddc71bf7ae07cdb30b6ead174b Mon Sep 17 00:00:00 2001 From: Chih-Wei Chang Date: Sat, 14 Feb 2015 22:36:28 +0800 Subject: [PATCH] Use simple function instead of class. --- opencv2/gcv_calib3d/gcv_calib3d_test.go | 16 ++++++------ opencv2/gcv_calib3d/gcv_core.hpp | 34 +++++-------------------- 2 files changed, 14 insertions(+), 36 deletions(-) diff --git a/opencv2/gcv_calib3d/gcv_calib3d_test.go b/opencv2/gcv_calib3d/gcv_calib3d_test.go index 62a897d..bdfb142 100644 --- a/opencv2/gcv_calib3d/gcv_calib3d_test.go +++ b/opencv2/gcv_calib3d/gcv_calib3d_test.go @@ -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) } diff --git a/opencv2/gcv_calib3d/gcv_core.hpp b/opencv2/gcv_calib3d/gcv_core.hpp index c1efb45..b7814d5 100644 --- a/opencv2/gcv_calib3d/gcv_core.hpp +++ b/opencv2/gcv_calib3d/gcv_core.hpp @@ -3,32 +3,10 @@ using namespace std; -class GcvPoint3f -{ -public: - GcvPoint3f (float x, float y, float z) - : _data(x, y, z) {}; - ~GcvPoint3f () {}; +cv::Point3f GetPoint3f(float x, float y, float z) { + return cv::Point3f(x, y, z); +} - cv::Point3f Get() { return _data; } - void Set(float x, float y, float z) { - _data = 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); - } -private: - cv::Point2f _data; -}; +cv::Point2f GetPoint2f(float x, float y) { + return cv::Point2f(x, y); +}