Use simple function instead of class.
This commit is contained in:
parent
9dbdf34f32
commit
8d629cd384
2 changed files with 14 additions and 36 deletions
|
|
@ -17,16 +17,16 @@ import "testing"
|
||||||
|
|
||||||
func TestGcvInitCameraMatrix2D(t *testing.T) {
|
func TestGcvInitCameraMatrix2D(t *testing.T) {
|
||||||
objPts := NewGcvPoint3fVector(int64(4))
|
objPts := NewGcvPoint3fVector(int64(4))
|
||||||
objPts.Set(0, NewGcvPoint3f(0, 25, 0).Get())
|
objPts.Set(0, GetPoint3f(0, 25, 0))
|
||||||
objPts.Set(1, NewGcvPoint3f(0, -25, 0).Get())
|
objPts.Set(1, GetPoint3f(0, -25, 0))
|
||||||
objPts.Set(2, NewGcvPoint3f(-47, 25, 0).Get())
|
objPts.Set(2, GetPoint3f(-47, 25, 0))
|
||||||
objPts.Set(3, NewGcvPoint3f(-47, -25, 0).Get())
|
objPts.Set(3, GetPoint3f(-47, -25, 0))
|
||||||
|
|
||||||
imgPts := NewGcvPoint2fVector(int64(4))
|
imgPts := NewGcvPoint2fVector(int64(4))
|
||||||
imgPts.Set(0, NewGcvPoint2f(1136.4140625, 1041.89208984).Get())
|
imgPts.Set(0, GetPoint2f(1136.4140625, 1041.89208984))
|
||||||
imgPts.Set(1, NewGcvPoint2f(1845.33190918, 671.39581299).Get())
|
imgPts.Set(1, GetPoint2f(1845.33190918, 671.39581299))
|
||||||
imgPts.Set(2, NewGcvPoint2f(302.73373413, 634.79998779).Get())
|
imgPts.Set(2, GetPoint2f(302.73373413, 634.79998779))
|
||||||
imgPts.Set(3, NewGcvPoint2f(1051.46154785, 352.76107788).Get())
|
imgPts.Set(3, GetPoint2f(1051.46154785, 352.76107788))
|
||||||
|
|
||||||
GcvInitCameraMatrix2D(objPts, imgPts)
|
GcvInitCameraMatrix2D(objPts, imgPts)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,32 +3,10 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class GcvPoint3f
|
cv::Point3f GetPoint3f(float x, float y, float z) {
|
||||||
{
|
return cv::Point3f(x, y, z);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
private:
|
|
||||||
cv::Point3f _data;
|
|
||||||
};
|
|
||||||
|
|
||||||
class GcvPoint2f
|
cv::Point2f GetPoint2f(float x, float y) {
|
||||||
{
|
return cv::Point2f(x, y);
|
||||||
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;
|
|
||||||
};
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue