Skip to content

Commit 1a271a5

Browse files
author
Fabien Servant
committed
Make vec2 available to camera module
1 parent 872af28 commit 1a271a5

File tree

6 files changed

+23
-18
lines changed

6 files changed

+23
-18
lines changed

pyTests/camera/test_equidistant.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,12 @@ def test_equidistant_default_constructor():
164164
assert intrinsic.h() == 1, "The Equidistant intrinsic's default height should be 1"
165165

166166
scale = intrinsic.getScale()
167-
assert avnum.getX(scale) == 1.0 and avnum.getY(scale) == 1.0
167+
assert scale[0] == 1.0 and scale[1] == 1.0
168+
169+
print(scale)
168170

169171
offset = intrinsic.getOffset()
170-
assert avnum.getX(offset) == 0.0 and avnum.getY(offset) == 0.0
172+
assert offset[0] == 0.0 and offset[1] == 0.0
171173

172174
assert intrinsic.sensorWidth() == 36.0
173175
assert intrinsic.sensorHeight() == 24.0
@@ -199,10 +201,10 @@ def test_equidistant_constructors():
199201
assert intrinsic1.h() == height, "The Equidistant intrinsic's height has not been correctly set"
200202

201203
scale = intrinsic1.getScale()
202-
assert avnum.getX(scale) == focal and avnum.getY(scale) == focal
204+
assert scale[0] == focal and scale[1] == focal
203205

204206
offset = intrinsic1.getOffset()
205-
assert avnum.getX(offset) == offset_x and avnum.getY(offset) == offset_y
207+
assert offset[0] == offset_x and offset[1] == offset_y
206208

207209
assert intrinsic1.sensorWidth() == 36.0
208210
assert intrinsic1.sensorHeight() == 24.0
@@ -222,10 +224,10 @@ def test_equidistant_constructors():
222224
assert intrinsic2.h() == height, "The Equidistant intrinsic's height has not been correctly set"
223225

224226
scale = intrinsic2.getScale()
225-
assert avnum.getX(scale) == focal and avnum.getY(scale) == focal
227+
assert scale[0] == focal and scale[1] == focal
226228

227229
offset = intrinsic2.getOffset()
228-
assert avnum.getX(offset) == offset_x and avnum.getY(offset) == offset_y
230+
assert offset[0] == offset_x and offset[1] == offset_y
229231

230232
assert intrinsic2.sensorWidth() == 36.0
231233
assert intrinsic2.sensorHeight() == 24.0

pyTests/camera/test_pinhole.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def test_pinhole_default_constructor():
158158
"The Pinhole intrinsic's focal length in Y should be 1.0"
159159

160160
offset = intrinsic.getOffset()
161-
assert avnum.getX(offset) == 0.0 and avnum.getY(offset) == 0.0
161+
assert offset[0] == 0.0 and offset[1] == 0.0
162162

163163
assert intrinsic.sensorWidth() == 36.0
164164
assert intrinsic.sensorHeight() == 24.0

pyTests/camera/test_undistortion_3de.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_undistortion_3de_constructor():
4747
undistortion = av.Undistortion3DEAnamorphic4(WIDTH, HEIGHT)
4848

4949
size = undistortion.getSize()
50-
assert avnum.getX(size) == WIDTH and avnum.getY(size) == HEIGHT
50+
assert size[0] == WIDTH and size[1] == HEIGHT
5151

5252
assert undistortion.getType() == av.UNDISTORTION_3DEANAMORPHIC4
5353

@@ -117,12 +117,12 @@ def test_undistortion_3de_get_set_size():
117117
size. """
118118
undistortion = av.Undistortion3DEAnamorphic4(WIDTH, HEIGHT)
119119
size = undistortion.getSize()
120-
assert avnum.getX(size) == WIDTH and avnum.getY(size) == HEIGHT
120+
assert size[0] == WIDTH and size[1] == HEIGHT
121121

122122
undistortion.setSize(HEIGHT, WIDTH)
123-
assert size != undistortion.getSize()
123+
assert (size != undistortion.getSize()).any()
124124
size = undistortion.getSize()
125-
assert avnum.getX(size) == HEIGHT and avnum.getY(size) == WIDTH
125+
assert size[0] == HEIGHT and size[1] == WIDTH
126126

127127

128128
@pytest.mark.skip(reason="Vec2 not binded")

pyTests/camera/test_undistortion_radial.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_undistortion_radial_constructor():
4747
undistortion = av.UndistortionRadialK3(WIDTH, HEIGHT)
4848

4949
size = undistortion.getSize()
50-
assert avnum.getX(size) == WIDTH and avnum.getY(size) == HEIGHT
50+
assert size[0] == WIDTH and size[1] == HEIGHT
5151

5252
assert undistortion.getType() == av.UNDISTORTION_RADIALK3
5353

@@ -117,12 +117,12 @@ def test_undistortion_radial_get_set_size():
117117
size. """
118118
undistortion = av.UndistortionRadialK3(WIDTH, HEIGHT)
119119
size = undistortion.getSize()
120-
assert avnum.getX(size) == WIDTH and avnum.getY(size) == HEIGHT
120+
assert size[0] == WIDTH and size[1] == HEIGHT
121121

122122
undistortion.setSize(HEIGHT, WIDTH)
123-
assert size != undistortion.getSize()
123+
assert (size != undistortion.getSize()).any()
124124
size = undistortion.getSize()
125-
assert avnum.getX(size) == HEIGHT and avnum.getY(size) == WIDTH
125+
assert size[0] == HEIGHT and size[1] == WIDTH
126126

127127

128128
@pytest.mark.skip(reason="Vec2 not binded")

src/aliceVision/camera/Camera.i

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
%include <aliceVision/global.i>
1010

11+
%include <aliceVision/numeric/eigen.i>
12+
%eigen_typemaps(Vec2)
13+
1114
%{
1215
#include <aliceVision/camera/camera.hpp>
1316
#include <aliceVision/camera/cameraCommon.hpp>

src/aliceVision/numeric/numeric.i

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77
%module (module="pyalicevision") numeric
88

9-
%include <aliceVision/global.i>
10-
%include <aliceVision/numeric/numeric.hpp>
11-
129
%include <aliceVision/numeric/eigen.i>
1310
%eigen_typemaps(Vec2)
1411

12+
%include <aliceVision/global.i>
13+
%include <aliceVision/numeric/numeric.hpp>
14+
1515
double getX(const Vec2 & vec);
1616
double getY(const Vec2 & vec);
1717

0 commit comments

Comments
 (0)