Datasets:
Modalities:
Video
Size:
n<1K
Tags:
respiratory-rate
respiration
contactless-sensing
remote-physiological-sensing
video
computer-vision
License:
File size: 1,052 Bytes
8cbdce1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #!/usr/bin/env python3
"""Minimal example: iterate over recordings, read frames, and (if present) load the belt reference.
python load_example.py --root <download_dir> --domain outdoor --max-frames 300
"""
import argparse
import cv2
import pandas as pd
ap = argparse.ArgumentParser()
ap.add_argument("--root", required=True)
ap.add_argument("--domain", choices=["indoor", "outdoor"], default="outdoor")
ap.add_argument("--max-frames", type=int, default=300)
a = ap.parse_args()
meta = pd.read_csv(f"{a.root}/metadata.csv")
meta = meta[meta.domain == a.domain]
for _, r in meta.iterrows():
cap = cv2.VideoCapture(f"{a.root}/{r.file_name}")
if not cap.isOpened():
print("not downloaded:", r.file_name)
continue
n = 0
while n < a.max_frames:
ok, frame = cap.read()
if not ok:
break
n += 1 # frame is a BGR uint8 array, shape (H, W, 3)
print(f"{r.file_name:38s} {int(r.width)}x{int(r.height)} @ {r.fps:g} fps, {r.duration_s:.0f} s, read {n} frames")
cap.release()
|