Skip to main content

Realsense remote recorder

Project description

RealsenseRecorder

A set of Python scripts to operate Intel Realsense Cameras. By using multi-thread techniques, this script can record color + depth from up to 4 Realsense Cameras (2 x L515 and 2 x D435)

Installation

From Source

git clone https://github.com/mvig-robotflow/rfimu-realsense-recorder
cd rfimu-realsense-recorder
python setup.py

From PyPi

python -m pip install markit-realsense-recorder

Usage

Script Usage

import io

import cv2
import numpy as np
import yaml
from realsense_recorder.common import new_realsense_camera_system_from_config, RealsenseSystemModel

cfg_str = """
realsense:
  cameras:
  - color:
    - exposure: -1
      format: rs.format.bgra8
      fps: 30
      height: 1080
      width: 1920
    depth: [] # Do not user depth 
    endpoint: {}
    imu: []
    product_id: 0B64 # 0B64 for L515
    product_line: L500 # Currently supported models are L500(L515) and D400(D435)
    ref: 1
    sn: f0220485 # SN of target Camera, can get from RealSenseViewer
  system:
    base_dir: ./realsense_data
    frame_queue_size: 100
    interactive: false
    interval_ms: 0
    use_bag: false
"""


def main():
    cfg = yaml.load(io.StringIO(cfg_str), yaml.SafeLoader)
    sys = new_realsense_camera_system_from_config(RealsenseSystemModel, cfg['realsense'], None)
    print(sys.cameras)
    cam = sys.cameras[0]
    cam.open()
    cam.start()
    mtx = np.array(cam.intrinsics_matrix)
    while True:
        color_image, depth_image, ts, sys_ts, frame_counter = cam.get_frames()
        cv2.imshow("frame", color_image)
        key = cv2.waitKey(1)
        if key == 27:
            print('esc break...')
            cv2.destroyAllWindows()
            break

main()

Command Line Usage

To Create and persist record configuration:

python -m realsense_recorder configure

To launch a remote record station that supports REST API

python -m realsense_recorder serve

To launch a remote record station that is calibrated

python -m realsense_recorder serve --calibration=path/to/calibration

Note: The calibration.json file is expected to be in the path/to/calibration directory. The calibration file can be generated by running python -m realsense_recorder calibrate

To run calibration

python -m realsense_recorder calibrate

To run post-processing

python -m realsense_recorder post_process --base_dir path/to/recording

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

markit-realsense-recorder-1.8.2.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

markit_realsense_recorder-1.8.2-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file markit-realsense-recorder-1.8.2.tar.gz.

File metadata

File hashes

Hashes for markit-realsense-recorder-1.8.2.tar.gz
Algorithm Hash digest
SHA256 42105f77ac69c58eb484a51786de8ce15fbf67b27d28790c8a7912053d09454b
MD5 0827c0d16b2747ec2ca571836ad28157
BLAKE2b-256 a563977700b0e4ade64e054e5ab6870dbaa3bb601165bc6b7b5a3306c9618c1f

See more details on using hashes here.

File details

Details for the file markit_realsense_recorder-1.8.2-py3-none-any.whl.

File metadata

File hashes

Hashes for markit_realsense_recorder-1.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 77267ccd73a2a75d0501aa7d4c38887de8b885af7486d5fc11517f4592383e43
MD5 e388f446fa0364707ed84d8fe03aba52
BLAKE2b-256 596bf53c123beab52d64ffa8a7aeb713ae82f2cf34438814dc47f422e6315cc2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page