Skip to content

Commit

Permalink
Adding config option for subsampling
Browse files Browse the repository at this point in the history
  • Loading branch information
kitizz committed Feb 12, 2017
1 parent 2e62375 commit e8d6c26
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
_float = float32

_spec = [
('frame_subsample', int64),
('frame_support', int64),
('angle_support', _float),
('planar_support', _float),
Expand All @@ -28,6 +29,7 @@
@jitclass(_spec)
class Config(object):
def __init__(self):
self.frame_subsample = 1
self.frame_support = 600
self.angle_support = 0.2
self.planar_support = 0.25
Expand Down
18 changes: 8 additions & 10 deletions src/Pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ def matlab_edges(seq, nthreads=4):
run(cmd, check=True, stdout=sys.stdout)


def process_sequence(seq, skip):
def process_sequence(seq):
'''
seq: Directory of sequence
skip: Sub sample the video frames by this amount.
'''
config_path = os.path.join(seq, 'config.yaml')
config = Config.load(config_path)

skip = config.frame_subsample
sub = 'rays_{}'.format(skip)

# Make images and edges first if they don't exists

edge_path = os.path.join(seq, 'edges')
if not os.path.exists(edge_path):
# Extract images from video first
Expand All @@ -47,14 +49,10 @@ def process_sequence(seq, skip):
RaySoup.build_voxel_grid(seq, sub)

cloud = RayCloud.load( cloud_path )

config_path = os.path.join(seq, 'config.yaml')
config = Config.load(
config_path,
eps=1/cloud.cam[0])
config.eps = 1/cloud.cam[0]

# Classify edges and save out
ClassifyEdges.detect(seq, sub, cloud, config, imtype='png')
# ClassifyEdges.detect(seq, sub, cloud, config, imtype='png')

# Reconstruct Non-Persistent Edges
OcclusionEdges.reconstruct(seq, sub, cloud, config)
Expand All @@ -65,4 +63,4 @@ def process_sequence(seq, skip):

if __name__ == '__main__':
seq = sys.argv[1]
process_sequence(seq, skip=2)
process_sequence(seq)
3 changes: 2 additions & 1 deletion src/RaySoup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ def extract_rays(seq, sub, skip=2, max_frame=None, imtype='png'):
frames, boxes = IO.read_rects( os.path.join(seq, 'rects.yaml') )
cloud.apply_bounding_boxes(frames, boxes)

print("Extracting Edge Rays")
for f in range(0, max_frame, skip):
if not valid_bool[f]:
continue
print("\rFrame: {} of {}".format(f, F), end=' '*16, flush=True)
print("\r\tFrame: {} of {}".format(f, F), end=' '*16, flush=True)

E = IO.imread( paths[f] )
pts, labels = Contours.find_contours_edge(E, low=20, high=35, min_length=30)
Expand Down

0 comments on commit e8d6c26

Please sign in to comment.