Skip to content

Commit 04c4c71

Browse files
committed
Update analyse_movie.ipynb, videoplayback.mp4, and piv.py
1 parent 92bc053 commit 04c4c71

3 files changed

Lines changed: 285 additions & 10 deletions

File tree

openpiv/examples/notebooks/analyse_movie.ipynb

Lines changed: 274 additions & 0 deletions
Large diffs are not rendered by default.
16.7 MB
Binary file not shown.

openpiv/piv.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"""
2727

2828

29-
def simple_piv(im1, im2):
29+
def simple_piv(im1, im2, plot=True):
3030
"""
3131
Simplest PIV run on the pair of images using default settings
3232
@@ -35,21 +35,22 @@ def simple_piv(im1, im2):
3535
(TIF is preferable, whatever imageio can read)
3636
3737
"""
38-
39-
frame_a = tools.imread(im1)
40-
frame_b = tools.imread(im2)
38+
if isinstance(im1, str):
39+
im1 = tools.imread(im1)
40+
im2 = tools.imread(im2)
4141

4242
vel = pyprocess.extended_search_area_piv(
43-
frame_a.astype(np.int32), frame_b.astype(np.int32), window_size=32,
43+
im1.astype(np.int32), im2.astype(np.int32), window_size=32,
4444
overlap=16, search_area_size=64
4545
)
46-
x, y = pyprocess.get_coordinates(image_size=frame_a.shape,
46+
x, y = pyprocess.get_coordinates(image_size=im1.shape,
4747
search_area_size=64, overlap=16)
4848

49-
fig, ax = plt.subplots(figsize=(6, 6))
50-
ax.imshow(frame_a, cmap=plt.get_cmap("gray"), alpha=0.8, origin="upper")
51-
ax.quiver(x, y, vel[0], vel[1], scale=50, color="r")
52-
plt.show()
49+
if plot:
50+
fig, ax = plt.subplots(figsize=(6, 6))
51+
ax.imshow(im1, cmap=plt.get_cmap("gray"), alpha=0.8, origin="upper")
52+
ax.quiver(x, y, vel[0], vel[1], scale=50, color="r")
53+
plt.show()
5354

5455
return x, y, vel[0], vel[1]
5556

0 commit comments

Comments
 (0)