Skip to content

Commit

Permalink
Prep for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjudge committed Jan 10, 2018
1 parent 9787528 commit 84bb36b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 30 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ _cache/
*.pyc
*.npy
*.pickle
*.png
*.gif
*.mp4


# Windows image file caches
Expand Down
20 changes: 4 additions & 16 deletions example_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,9 @@

def clip_heatmap():
# logging.root.setLevel(logging.DEBUG)
vid = video.Video(r"../../../../../YUNC0001.mp4")
clip = video.Clip(vid, 26400, 26460)
# 9900, 9920
# 20750, 20850
# 20750, 20800
# 9900, 10100
# 9900, 9930
# 26400, 26460
# 10101, 10160
# 26400, 26500
# 31302, 31600
# 31590, 31900
# 13100, 13200
# 14550, 14610
# 15000, 15200
# vid = video.Video(r"video1.mp4")
vid = video.Video(r"video2.mp4")
clip = video.Clip(vid, startframe=0, stopframe=298)

print("Loaded video {fname}, shape: {shape}, fps: {fps}, start: {start}, stop: {stop}".format(
fname=clip.video.path, shape=clip.video.shape, fps=clip.video.fps,
Expand All @@ -34,7 +22,7 @@ def clip_heatmap():
)

reconstruction.render_reconstruct_world(
clip, camera_proj_mat, frame_step=3, path='./output/', include_intermediates=True, multiproc=True,
clip, camera_proj_mat, frame_step=3, path='./output/', include_intermediates=False, multiproc=False,
render_mode='standard', render_scale=3.3, render_gsigma=1
)

Expand Down
20 changes: 10 additions & 10 deletions field_reconstruction/reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ def triangulate_frames(vid, frame_pair, K):
:param frame_pair: Tuple of two frame numbers (frame1, frame2)
:param K: [3,3] Camera calibration matrix
:returns: points, velocities, P1, P2, R, t
WHERE
points are a [3, N] numpy array point cloud
velocities are the velocities returned by the dtcwt transform
as a [2, Y, X] numpy array (see :func:`dtcwt_registration.load_velocity_fields`)
P1, P2, R, t are the projection matrix parameters
returned by :func:`estimate_projections`)
WHERE
- points are a [3, N] numpy array point cloud
- velocities are the velocities returned by the dtcwt transform
as a [2, Y, X] numpy array (see :func:`dtcwt_registration.load_velocity_fields`)
- P1, P2, R, t are the projection matrix parameters
returned by :func:`estimate_projections`)
"""
vel = dtcwt_registration.load_velocity_fields(vid, *frame_pair)[:, 50:-50, 50:-50]
corr1, corr2 = create_pixel_correspondences(vel)
Expand All @@ -167,10 +167,10 @@ def generate_frame_pair_cloud(vid, frame_pair, K):
:param frame_pair: Tuple of two frame numbers (frame1, frame2)
:param K: [3,3] Camera calibration matrix
:return: pointcloud, velocities
WHERE
pointcloud is an instance of :class:`pointcloud.Pointcloud`
velocities are the velocities returned by the dtcwt transform
as a [2, Y, X] numpy array (see :func:`dtcwt_registration.load_velocity_fields`)
WHERE
- pointcloud is an instance of :class:`pointcloud.Pointcloud`
- velocities are the velocities returned by the dtcwt transform
as a [2, Y, X] numpy array (see :func:`dtcwt_registration.load_velocity_fields`)
"""
points, vel, P1, P2, R, t = triangulate_frames(vid, frame_pair, K)
imshape = vel.shape[1:]
Expand Down
5 changes: 3 additions & 2 deletions field_reconstruction/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, path):
int(self.vidcap.get(cv2.CAP_PROP_FRAME_HEIGHT)),
int(self.vidcap.get(cv2.CAP_PROP_FRAME_WIDTH))
)
self.frame_count = self.vidcap.get(cv2.CAP_PROP_FRAME_COUNT)
self.frame_count = int(self.vidcap.get(cv2.CAP_PROP_FRAME_COUNT))

def __str__(self):
return self.name
Expand Down Expand Up @@ -97,7 +97,8 @@ def __init__(self, video, startframe=0, stopframe=None):
self.stop_frame = self.video.frame_count
elif stopframe > self.video.frame_count:
raise IndexError("Clip must be within video length (stopframe value too large)")
self.stop_frame = stopframe # stopframe is NOT included in the clip
else:
self.stop_frame = stopframe # stopframe is NOT included in the clip
self.frame_count = self.stop_frame - self.start_frame

def get_frame_number(self, frame_number):
Expand Down

0 comments on commit 84bb36b

Please sign in to comment.