Skip to content

A web service for live streaming RGB, capturing the current RGB frame and finding the depth and 3D coordinates of a given point from Intel RealSense cameras

License

Notifications You must be signed in to change notification settings

millerhooks/realsense-webservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Web Service for Intel RealSense Camera

This is a web service written in python Flask for RealSense Cameras which are compatible with Intel RealSense SDK 2.0.
The end points are

  • startStream: Stream RGB frames from camera
  • getImage: Get the current RGB frame
  • getDepth: Get depth of a given point in RGB image
  • get3d: Get 3d coordinates in metre of a given point in RGB image

Prerequisites

  • Install latest version of python 2 with pip
  • Pip install python dependencies
    pip install Flask
    pip install numpy
    pip install opencv-python

Do NOT pip install pyrealsense2. This is the python wrapper for Intel RealSense SDK 1 (as of 27/06/2018)

  • Download and install Intel RealSense SDK 2 from here

Launching the web service

Connect your RealSense camera and run the python script cameraWebService
python cameraWebService.py

If you don't have a camera avalable, you can run the script testWebService
python testWebService.py
This uses a recorded camera data which can be downloaded from here

Endpoint Documentation

startStream

To start stream of RGB frames from camera

  • URL /startStream
  • Method GET
  • Success Response: The current RGB input from camera as MJPEG. The resolution will be max camera resolution.

getImage

To get the current RGB frame

  • URL /getImage
  • Method GET
  • Success Response: A JPEG image of the current RGB frame of camera input. The resolution will be max camera resolution.

getDepth

To get the current depth of an (x,y) pixel coordinate of the RGB image. The response will be a floating-point value as a string which correspond to the depth in metres. The request coordinates must be in bound with the maximum resolution.

  • URL /getDepth?x=[integer]&y=[integer]
  • Method GET
  • Success Response: 0.6550000309944153
  • Error Response: Invalid coordinate values

get3d

To get the current 3D real world coordinates in metres of an (x,y) pixel coordinate of the RGB image. The response will be x,y,z coordinates in JSON format. The request coordinates must be in bound with the maximum resolution.

  • URL /get3d?x=[integer]&y=[integer]
  • Method GET
  • Success Response:
    { "x": 0.5442482456265268 "y": 0.4660094894248493 "z": 0.3578798298485989 }
  • Error Response: Invalid coordinate values

Acknowledgement

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A web service for live streaming RGB, capturing the current RGB frame and finding the depth and 3D coordinates of a given point from Intel RealSense cameras

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages