API使用说明

请求基地址

所有请求均使用 HTTP 协议,使用RESTful风格API,基础 URL 格式如下:

http://<ip>:5000/api/
其中 <ip> 是相机的 IP 地址。

数据传输格式

  1. 参数格式一般使用JSON格式进行传输

  2. 图像,深度图,点云等格式使用EpicRaw格式进行存储,以下为EpicRaw格式说明

EpicRaw1

  • Header

    FileType = "EPICRAW1"         // 8 bytes, version info
    width = int32                 // 4 bytes
    height = int32                // 4 bytes
    // 3 * 3 camera matrix, row major
    camera matrix = float64 * 9   // 8 * 9 = 72 bytes, camera matrix
    distortion = float64 * 5      // 8 * 5 = 40 bytes, camera distortion
        // K1  = float64
        // K2  = float64
        // P1  = float64
        // P2  = float64
        // K3  = float64
    camera config                 // 4 * 7 = 28 bytes, camera configs
        // projector brightness = int32
        // exp time 2d          = float32
        // exp time 3d          = float32
        // use hdr              = bool but save as int32
        // exp time hdr         = float32
        // use PF               = bool but save as int32
        // use SF               = bool but save as int32
    data type = int32             // 4 bytes
        // 0: RGB only
        // 1: depth only
        // 4: depth + RGB
    depth data length = int32     // 4 bytes
    image data length = int32     // 4 bytes
    
    
    Total: 168 bytes
  • Data

    1. depth data:长度为depth data length

    2. image data:长度为image data length

    总长度 = depth data length + image data length

EpicRaw2

  • Header

    FileType = "EPICRAW2"         // 8 bytes, version info
    width = int32                 // 4 bytes
    height = int32                // 4 bytes
    data type = int32             // 4 bytes
        // 0: RGB only
        // 1: depth only
        // 2: RGB16bit image only
        // 4: depth + RGB
        // 8: depth + RGB16bit
        // 16: origin Fringe-Pattern images
    camera matrix length = int32  // 4 bytes, default: 8 * 9 = 72, row major
    distortion length = int32     // 4 bytes
    config str length = int32     // 4 bytes
    depth data length = int32     // 4 bytes
    image data length = int32     // 4 bytes
    
    
    Total: 40 bytes
  • Data

    1. Camera matrix

      默认长度: float64 * 9 → 8 * 9 = 72 bytes

      内容: 3 * 3 camera matrix, row major

    2. Distortion

      内容参照OpenCV畸变系数协定

      distortion coefficients (k1,k2,p1,p2[,k3[,k4,k5,k6[,s1,s2,s3,s4[,τx,τy]]]]) of 4, 5, 8, 12 or 14 elements.

      一般系数长度为5,数据类型为float64,即K1, K2, P1, P2, K3,长度为5 * 8 = 40 bytes

    3. Config string:以json str格式存储

    4. Depth data:长度为depth data length

    5. Image data:长度为image data length

    总长度 = camera matrix length + distortion length + config str length + depth data length + image data length

接口列表

请参阅接口列表

错误处理

若请求未成功,将返回相应的 HTTP 错误状态码,并根据具体情况返回附加信息。

注意事项

  • 某些接口调用需要确定相机的 IP 地址和相应的参数,确保参数正确性以避免请求失败。

  • 使用过程中若遇到问题,可参考返回的错误信息或检查相机网络连接情况。