Skip to content

Commit 1464087

Browse files
authored
Merge pull request #49 from ThijsIllimited/master
DDIC testing
2 parents c6abfc8 + 977c7a1 commit 1464087

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

examples/Showcas_LK_1D.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@
3838
},
3939
{
4040
"cell_type": "code",
41-
"execution_count": 2,
41+
"execution_count": null,
4242
"metadata": {},
4343
"outputs": [],
4444
"source": [
45-
"filename = 'data/data_synthetic.cih'\n",
45+
"filename = '../data/data_synthetic.cih'\n",
4646
"video = pyidi.VideoReader(filename)"
4747
]
4848
},
@@ -428,7 +428,7 @@
428428
"metadata": {
429429
"hide_input": false,
430430
"kernelspec": {
431-
"display_name": ".venv",
431+
"display_name": "base",
432432
"language": "python",
433433
"name": "python3"
434434
},
@@ -442,7 +442,7 @@
442442
"name": "python",
443443
"nbconvert_exporter": "python",
444444
"pygments_lexer": "ipython3",
445-
"version": "3.12.8"
445+
"version": "3.12.3"
446446
},
447447
"toc": {
448448
"base_numbering": 1,

tests/test_basic.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ def test_instance():
99
video = pyidi.VideoReader(input_file='./data/data_synthetic.cih')
1010
lk = pyidi.LucasKanade(video)
1111
sof = pyidi.SimplifiedOpticalFlow(video)
12+
lk1d = pyidi.DirectionalLucasKanade(video)
1213

1314
assert True
1415
# print('test_instance: passed')
@@ -32,6 +33,15 @@ def test_points_lk():
3233
# print('test_points_lk: passed')
3334
return None
3435

36+
def test_points_lk1d():
37+
video = pyidi.VideoReader(input_file='./data/data_synthetic.cih')
38+
lk1d = pyidi.DirectionalLucasKanade(video)
39+
lk1d.set_points(points=[(0, 1), (1, 1)])
40+
41+
assert True
42+
# print('test_points_lk: passed')
43+
return None
44+
3545
# def test_info():
3646
# video = pyidi.pyIDI(input_file='./data/data_synthetic.cih')
3747
# assert 'Shutter Speed(s)' in video.reader.info.keys()
@@ -44,6 +54,7 @@ def test_points_lk():
4454
test_instance()
4555
test_points_sof()
4656
test_points_lk()
57+
test_points_lk1d()
4758

4859
# if __name__ == '__mains__':
4960
# np.testing.run_module_suite()

tests/test_get_displacements.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,23 @@ def test_cih_lk():
2424

2525
return None
2626

27+
def test_cih_lk1d():
28+
video = pyidi.VideoReader(input_file='./data/data_synthetic.cih')
29+
lk1d = pyidi.DirectionalLucasKanade(video)
30+
31+
points = np.array([
32+
[ 31, 35],
33+
[ 31, 215],
34+
[ 31, 126],
35+
[ 95, 71],
36+
])
37+
lk1d.set_points(points)
38+
lk1d.configure(dij = (0.5, 0.5), int_order=1, verbose=0, show_pbar=False)
39+
dsp = lk1d.get_displacements(autosave=False)
40+
41+
np.testing.assert_array_equal(dsp.shape, (len(points), video.N, 2))
42+
return None
43+
2744
def test_png_sof():
2845
video = pyidi.VideoReader(input_file='./data/data_synthetic_img_0.png')
2946
sof = pyidi.SimplifiedOpticalFlow(video)
@@ -44,4 +61,5 @@ def test_png_sof():
4461

4562
if __name__ == '__main__':
4663
test_cih_lk()
64+
test_cih_lk1d()
4765
test_png_sof()

0 commit comments

Comments
 (0)